DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Floating point operations

Conversion of floating point formats to integer

IEEE requires floating point to integer format conversions to be affected by the current rounding mode. However, the C language requires these conversions to be done by truncation (which is the same as round-to-zero). In the C compilation system floating point to integer conversions are done by truncation.

Conversion of floating point numbers to integers should signal integer overflow or invalid operation for an overflow condition. In the current implementation the integer overflow flag is set, but there is no way to enable the overflow trap. Enabling the integer overflow trap would result in a substantial performance penalty due to stalled pipeline effects.

The C compilation system provides the rint function for IEEE-style conversion from floating point to integers. For information on the rint function, see floor(S).


Next topic: Square root
Previous topic: IEEE requirements

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005