round ( x -- y ) (original) (raw)
round ( x -- y )
Factor handbook » The language » Numbers » Mathematical functions » Arithmetic functions
Prev: | truncate ( x -- y ) |
---|---|
Next: | round-to-decimal ( x n -- y ) |
Inputs
x | a real |
---|
Outputs
y | a 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
USING: kernel math math.functions ;