fyl2x

Y * log2(X)

FYL2X

Computes ST(1) * log2(ST(0)).

Details

Computes ST(1) * log₂(ST(0)) and replaces both stack entries with the result in ST(0); the stack pointer is decremented. ST(0) must be strictly positive; the result is typically used for computing logarithmic and exponential functions. The x87 status flags are updated; C2 may be set for out-of-range arguments.

Pseudocode Operation

ST(0) ← ST(1) * log2(ST(0)); pop(); TOS ← TOS - 1

Example

FYL2X

Encoding

Binary Layout
D9
+0
F1
+1
 
Format Legacy
Opcode D9 F1
Extension x87 FPU

Operands

Reference (Intel® SDM)

Instruction Forms

Opcode Instruction Op/En 64/32-bit Mode CPUID Description
D9 F1 FYL2X Valid Valid Replace ST(1) with (ST(1) ∗ log2ST(0)) and pop the register stack.

Description

Computes (ST(1) ∗ log2 (ST(0))), stores the result in register ST(1), and pops the FPU register stack. The source operand in ST(0) must be a non-zero positive number. The following table shows the results obtained when taking the log of various classes of numbers, assuming that neither overflow nor underflow occurs. Table 3-50. FYL2X Results ST(0) − ∞ − F ±0 +0<+F<+1 + 1 + F > + 1 + ∞ NaN − ∞ * * + ∞ + ∞ * − ∞ − ∞ NaN ST(1) − F * * ** + F − 0 − F − ∞ NaN − 0 * * * + 0 − 0 − 0 * NaN + 0 * * * − 0 + 0 + 0 * NaN + F * * ** − F + 0 + F + ∞ NaN + ∞ * * − ∞ − ∞ * + ∞ + ∞ NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN

Operation

ST(1) := ST(1) ∗ log2ST(0);
PopRegisterStack;

Exceptions

Protected Mode Exceptions

#NM CR0.EM[bit 2] or CR0.TS[bit 3] = 1. #MF If there is a pending x87 FPU exception. #UD If the LOCK prefix is used.

Real-Address Mode Exceptions

Same exceptions as in protected mode.

Virtual-8086 Mode Exceptions

Same exceptions as in protected mode.

Compatibility Mode Exceptions

Same exceptions as in protected mode.

64-Bit Mode Exceptions

Same exceptions as in protected mode. FYL2X—Compute y * log2x Vol. 2A 3-423