Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: PowerPC Numerics / Part 2 - The PowerPC Numerics C Implementation
Chapter 9 - Conversion Functions


Converting Floating-Point to Integer Formats

In C, the default method of converting floating-point numbers to integers is to simply discard the fractional part (truncate). MathLib provides two functions that convert floating-point numbers to integers using methods other than the default C method and that return the integers in integer types.
rinttol(x) Returns the nearest integer to x in the current rounding direction as an integer type.
roundtol(x) Adds 1/2 to the magnitude of x, chops to an integer, and returns the value as an integer type.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 JUL 1996