MROUND (Number, Multiple) MROUND (Number; Multiple)

Number

Number Number

The input number.

Multiple

Number Number

The multiple to which the input number should be rounded.

Returns

Number Number

A rounded number.

Returns a number rounded to a multiple of another number. If the number and the multiple have opposite signs, the result is an error.

Examples

MROUND (13, 4)
MROUND (13; 4)

Returns 12, which is the closest multiple of 4 to 13.

MROUND (15, 4)
MROUND (15; 4)

Returns 16, which is the closest multiple of 4 to 15.

MROUND (16, 4)
MROUND (16; 4)

Returns 16, as 16 is already a multiple of 4.

MROUND ({ 16, 21 }, 4)
MROUND ({ 16; 21 }; 4)

Returns the array { 16, 20 }{ 16; 20 }, with 16 already being a multiple of 4 and 20 being the closest multiple of 4 to 21.

MROUND (1.23, 0.05)
MROUND (1,23; 0,05)

Returns 1.25, the price 1.23 rounded to the nearest five cents.

fxEngine Shell Want this in your own terminal? A standalone version is coming. Get notified.
Loading fxEngine Shell