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

Prev:truncate ( x -- y )
Next:round-to-decimal ( x n -- y )


Vocabulary
math.functions

Inputs
xa real


Outputs
ya whole real number


Word description
Outputs the whole number closest to x, rounding out at half.

Notes
The result is not necessarily an integer.

Examples
USING: math.functions prettyprint ; 4.5 round .
5.0

USING: math.functions prettyprint ; 4.4 round .
4.0


Definition


Methods