Intel 64 and IA-32 Architectures Software Developers Manual Volume 2A, Instruction Set Reference, A-M

Vol. 2 3-355
INSTRUCTION SET REFERENCE, A-M
There is no restriction on the range of source operands that FPATAN can accept.
This instruction’s operation is the same in non-64-bit modes and 64-bit mode.
IA-32 Architecture Compatibility
The source operands for this instruction are restricted for the 80287 math copro-
cessor to the following range:
0 |ST(1)| < |ST(0)| < +∞
Operation
ST(1) arctan(ST(1) / ST(0));
PopRegisterStack;
Table 3-35. FPATAN Results
ST(0)
−∞ F 0 +0 +F +∞ NaN
−∞ 3π/4* −π/2 −π/2 −π/2 −π/2 −π/4* NaN
ST(1) F −π −π to −π/2 −π/2 −π/2 −π/2 to
0
-0 NaN
0 −π −π π
* 0* 0 0NaN
+0 * +0* +0 +0NaN
+F to +π/2 +π/2 +π/2 +π/2 to
+0
+0NaN
+∞ +3π/4* +π/2 +π/2 /2 +π/2 /4* NaN
NaN NaN NaN NaN NaN NaN NaN NaN
NOTES:
F Means finite floating-point value.
* Table 8-10 in the Intel® 64 and IA-32 Architectures Software Developer’s Manual, Volume 1,
specifies that the ratios 0/0 and •/• generate the floating-point invalid arithmetic-operation
exception and, if this exception is masked, the floating-point QNaN indefinite value is returned.
With the FPATAN instruction, the 0/0 or •/• value is actually not calculated using division.
Instead, the arctangent of the two variables is derived from a standard mathematical formula-
tion that is generalized to allow complex numbers as arguments. In this complex variable formu-
lation, arctangent(0,0) etc. has well defined values. These values are needed to develop a library
to compute transcendental functions with complex arguments, based on the FPU functions that
only allow floating-point values as arguments.