Go to the first, previous, next, last section, table of contents.
To convert an integer to floating point, use the function float
.
- Function: float number
-
This returns number converted to floating point.
If number is already a floating point number,
float
returns
it unchanged.
There are four functions to convert floating point numbers to integers;
they differ in how they round. These functions accept integer arguments
also, and return such arguments unchanged.
- Function: truncate number
-
This returns number, converted to an integer by rounding towards
zero.
- Function: floor number &optional divisor
-
This returns number, converted to an integer by rounding downward
(towards negative infinity).
If divisor is specified, number is divided by divisor
before the floor is taken; this uses the kind of division operation that
corresponds to mod
, rounding downward. An arith-error
results if divisor is 0.
- Function: ceiling number
-
This returns number, converted to an integer by rounding upward
(towards positive infinity).
- Function: round number
-
This returns number, converted to an integer by rounding towards the
nearest integer. Rounding a value equidistant between two integers
may choose the integer closer to zero, or it may prefer an even integer,
depending on your machine.
Go to the first, previous, next, last section, table of contents.