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 / Performing Calculations on Fixed-Point Numbers


FixATan2

You can use the FixATan2 function to obtain a fast approximation of the arctangent of a fraction.

FUNCTION FixATan2 (x, y: LongInt): Fixed;
x
The numerator of the fraction whose arctangent is to be obtained. This variable can be a LongInt, Fixed, or Fract number.
y
The denominator of the fraction whose arctangent is to be obtained. The number supplied in this variable must be of the same type as that of the number supplied in the x parameter.
DESCRIPTION
The FixATan2 function returns, in radians, the arctangent of y/x.

The approximation of Pi/4 used to compute the arctangent is the hexadecimal value 0.C910, making the approximation of Pi equal to 3.1416015625, while Pi itself equals 3.14159265.... Thus FixATan2(1, 1)equals the equivalent of the hexadecimal value 0.C910. Despite the approximation of Pi, the arctangent value obtained will usually be correct to several decimal places.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996