Intel 64 and IA-32 Architectures Software Developers Manual Volume 1, Basic Architecture

Vol. 1 8-31
PROGRAMMING WITH THE X87 FPU
Similar versions of π can also be written in double extended-precision floating-point
format.
When using this two-part π value in an algorithm, parallel computations should be
performed on each part, with the results kept separate. When all the computations
are complete, the two results can be added together to form the final result.
The complications of maintaining a consistent value of π for argument reduction can
be avoided, either by applying the trigonometric functions only to arguments within
the range of the automatic reduction mechanism, or by performing all argument
reductions (down to a magnitude less than π/4) explicitly in software.
8.3.9 Logarithmic, Exponential, and Scale
The following instructions provide two different logarithmic functions, an exponential
function and a scale function:
FYL2X Logarithm
FYL2XP1 Logarithm epsilon
F2XM1 Exponential
FSCALE Scale
The FYL2X and FYL2XP1 instructions perform two different base 2 logarithmic opera-
tions. The FYL2X instruction computes (y log
2
x). This operation permits the calcu-
lation of the log of any base using the following equation:
log
b
x = (1/log
2
b) log
2
x
The FYL2XP1 instruction computes (y log
2
(x + 1)). This operation provides
optimum accuracy for values of x that are close to 0.
The F2XM1 instruction computes (2
x
1). This instruction only operates on source
values in the range 1.0 to +1.0.
The FSCALE instruction multiplies the source operand by a power of 2.
8.3.10 Transcendental Instruction Accuracy
New transcendental instruction algorithms were incorporated into the IA-32 architec-
ture beginning with the Pentium processors. These new algorithms (used in tran-
scendental instructions FSIN, FCOS, FSINCOS, FPTAN, FPATAN, F2XM1, FYL2X, and
FYL2XP1) allow a higher level of accuracy than was possible in earlier IA-32 proces-
sors and x87 math coprocessors. The accuracy of these instructions is measured in
terms of units in the last place (ulp). For a given argument x, let f(x) and F(x) be