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: Operating System Utilities /
Chapter 3 - Mathematical and Logical Utilities / Mathematical and Logical Utilities Reference
Routines / Converting Between Fixed-Point and Integral Values


FixRound

You can use the FixRound function to round a fixed-point number to the nearest integer.

FUNCTION FixRound (x: Fixed): Integer;
x
The Fixed number to be rounded.
DESCRIPTION
The FixRound function returns the Integer number nearest the Fixed number you supply in the x parameter. If the value is halfway between two integers (0.5), it is rounded up. Thus, 4.5 is rounded to 5, and -3.5 is rounded to -3.

To round a negative Fixed number so that values halfway between two integers are rounded to the number with the higher absolute value, negate the number, round it, and then negate it again.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996