Computer Hardware User's Manual

Vol. 2A 3-433
INSTRUCTION SET REFERENCE, A-M
FYL2XP1—Compute y * log2(x +1)
FYL2XP1—Compute y log
2
(x +1)
Description
Computes (ST(1) log
2
(ST(0) + 1.0)), stores the result in register ST(1), and pops
the FPU register stack. The source operand in ST(0) must be in the range:
The source operand in ST(1) can range from to +. If the ST(0) operand is outside
of its acceptable range, the result is undefined and software should not rely on an
exception being generated. Under some circumstances exceptions may be generated
when ST(0) is out of range, but this behavior is implementation specific and not
guaranteed.
The following table shows the results obtained when taking the log epsilon of various
classes of numbers, assuming that underflow does not occur.
This instruction provides optimal accuracy for values of epsilon [the value in register
ST(0)] that are close to 0. For small epsilon (ε) values, more significant digits can be
retained by using the FYL2XP1 instruction than by using (ε+1) as an argument to the
FYL2X instruction. The (ε+1) expression is commonly found in compound interest and
annuity calculations. The result can be simply converted into a value in another loga-
rithm base by including a scale factor in the ST(1) source operand. The following
Opcode Instruction 64-Bit
Mode
Compat/
Leg Mode
Description
D9 F9 FYL2XP1 Valid Valid Replace ST(1) with ST(1) log
2
(ST(0)
+ 1.0) and pop the register stack.
Table 3-54. FYL2XP1 Results
ST(0)
(1 ( )) to 0 0 +0 +0 to +(1 ())NaN
+ ** NaN
ST(1) F +F +0 0 FNaN
0 +0 +0 0 0NaN
+0 0 0 +0 +0NaN
+F F 0 +0 +FNaN
+
** + NaN
NaN NaN NaN NaN NaN NaN
NOTES:
F Means finite floating-point value.
* Indicates floating-point invalid-operation (#IA) exception.
122())to 1 2 2()
22 22