FYL2XP1

Compute y log2(x +1)

stableVMJITAOTinstruction

Encodings

OpcodeInstructionOp/En64-bitCompat/LegacyDescription
D9 F9FYL2XP1ValidValidReplace ST(1) with ST(1) log2(ST(0) + 1.0) and pop the register stack.

Measured cost

Loading measurements from arch-data...

Description

Computes (ST(1) log2(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:

     (1  2 / 2) )to(1  2 / 2)

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.

FYL2XP1 Results

-(1 - (2 / 2 )) to -0-0+0+0 to +(1 - (2 / 2 ))NaN
+**-NaN
+F+0-0-FNaN
+0+0-0-0NaN
-0-0+0+0NaN
-F-0+0+FNaN
-**+NaN
NaNNaNNaNNaNNaN

Operation

ST(1) := ST(1)  log2(ST(0) + 1.0);
PopRegisterStack;


FPU Flags Affected

C1                  Set to 0 if stack underflow occurred.

                    Set if result was rounded up; cleared otherwise.

C0, C2, C3          Undefined.

Floating-Point Exceptions

#IS                 Stack underflow occurred.
#IA                 Either operand is an SNaN value or unsupported format.
#D                  Source operand is a denormal value.
#U                  Result is too small for destination format.
#O                  Result is too large for destination format.
#P                  Value cannot be represented exactly in destination format.

Exceptions

Protected mode
#NMCR0.EM[bit 2] or CR0.TS[bit 3] = 1.
#MFIf there is a pending x87 FPU exception.
#UDIf the LOCK prefix is used.
Real address mode
Same exceptions as in protected mode.
Virtual-8086 mode
Same exceptions as in protected mode.
Compatibility mode
Same exceptions as in protected mode.
64-bit mode
Same exceptions as in protected mode.

Sources