User Tools

Site Tools


syntax:functions:mround

This is an old revision of the document!


MRound(number, grain)

Category: Number function


Description

This function rounds a number to the desired multiple (grain).


Arguments

ArgumentTypeDescription
numberNumberThe value, usually fractional, to be rounded.
grainNumberThe multiple to round number to.


Return value type: Number


Remarks

MRound uses "bankers rounding" which rounds to the nearest even value.


Examples

mround(5.3, 0.5) //Returns 5.5
mround(10.05, 0.1) //Returns 10.0 (.05 rounds down)
mround(10.06, 0.1) //Returns 10.1 (greater than .05 rounds up)
mround(20.78, 1) //Returns 21
mround(57, 15) //Returns 60


See also

syntax/functions/mround.1631029746.txt.gz · Last modified: 2021/09/07 11:49 by craigt

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki