Intel 64 and IA-32 Architectures Software Developers Manual Volume 1, Basic Architecture
8-30 Vol. 1
PROGRAMMING WITH THE X87 FPU
8.3.8 Pi
When the argument (source operand) of a trigonometric function is within the range
of the function, the argument is automatically reduced by the appropriate multiple of
2π through the same reduction mechanism used by the FPREM and FPREM1 instruc-
tions. The internal value of π that the x87 FPU uses for argument reduction and other
computations is as follows:
π = 0.f ∗ 2
2
where:
f = C90FDAA2 2168C234 C
(The spaces in the fraction above indicate 32-bit boundaries.)
This internal π value has a 66-bit mantissa, which is 2 bits more than is allowed in the
significand of an double extended-precision floating-point value. (Since 66 bits is not
an even number of hexadecimal digits, two additional zeros have been added to the
value so that it can be represented in hexadecimal format. The least-significant
hexadecimal digit (C) is thus 1100B, where the two least-significant bits represent
bits 67 and 68 of the mantissa.)
This value of π has been chosen to guarantee no loss of significance in a source
operand, provided the operand is within the specified range for the instruction.
If the results of computations that explicitly use π are to be used in the FSIN, FCOS,
FSINCOS, or FPTAN instructions, the full 66-bit fraction of π should be used. This
insures that the results are consistent with the argument-reduction algorithms that
these instructions use. Using a rounded version of π can cause inaccuracies in result
values, which if propagated through several calculations, might result in meaningless
results.
A common method of representing the full 66-bit fraction of π is to separate the value
into two numbers (highπ and lowπ) that when added together give the value for π
shown earlier in this section with the full 66-bit fraction:
π = highπ + lowπ
For example, the following two values (given in scientific notation with the fraction in
hexadecimal and the exponent in decimal) represent the 33 most-significant and the
33 least-significant bits of the fraction:
highπ (unnormalized) = 0.C90FDAA20 * 2
+2
lowπ (unnormalized) = 0.42D184698 * 2
− 31
These values encoded in the IEEE double-precision floating-point format are as
follows:
highπ = 400921FB 54400000
lowπ = 3DE0B461 1A600000
(Note that in the IEEE double-precision floating-point format, the exponents are
biased (by 1023) and the fractions are normalized.)