round-to-step ( x step -- y )
Factor handbook » The language » Numbers » Mathematical functions » Arithmetic functions

Prev:round-to-decimal ( x n -- y )
Next:~ ( x y epsilon -- ? )


Vocabulary
math.functions

Inputs
xa real
stepa real


Outputs
ya real


Word description
Outputs the number closest to x, rounded to a multiple of step.

Notes
The result is not necessarily an integer.

Examples
USING: math.functions prettyprint ; 1.23456 0.25 round-to-step .
1.25

USING: math.functions prettyprint ; 12345.6789 100 round-to-step .
12300.0


Definition