(lispref.info)Numeric Conversions


Next: Arithmetic Operations Prev: Comparison of Numbers Up: Numbers

Numeric Conversions
===================

   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.  You can call these functions
with an integer argument also; if you do, they return it without change.

 - 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 is the division operation that corresponds to
     `mod'.  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.


automatically generated by info2www