Next: , Previous: , Up: Numbers   [Contents][Index]


5.4.7 Real Number Functions

Function: inexact->exact x

Returns an exact representation of x. This may involve a loss of accuracy.

Function: abs x

Returns the magnitude of x.

Function: floor x

Round x downwards to the nearest integer less than or equal to x.

Four rounding functions are provided. With gmp, they return integer. Without gmp, they return float type, just like libc counterparts, to avoid overflow. You can convert it to integer with inexact->exact.

Function: ceiling x

Round x upwards to the nearest integer less than or equal to x.

Function: truncate x

Round x to the nearest integer between x and zero.

Function: round x

Round x to the nearest integer. Halfway cases are rounded to the nearest even integer.