Intel 64 and IA-32 Architectures Software Developers Manual Volume 1, Basic Architecture
8-32 Vol. 1
PROGRAMMING WITH THE X87 FPU
the correct and computed (approximate) function values, respectively. The error in
ulps is defined to be:
where k is an integer such that:
With the Pentium processor and later IA-32 processors, the worst case error on
transcendental functions is less than 1 ulp when rounding to the nearest (even) and
less than 1.5 ulps when rounding in other modes. The functions are guaranteed to be
monotonic, with respect to the input operands, throughout the domain supported by
the instruction.
The instructions FYL2X and FYL2XP1 are two operand instructions and are guaran-
teed to be within 1 ulp only when y equals 1. When y is not equal to 1, the maximum
ulp error is always within 1.35 ulps in round to nearest mode. (For the two operand
functions, monotonicity was proved by holding one of the operands constant.)
8.3.11 x87 FPU Control Instructions
The following instructions control the state and modes of operation of the x87 FPU.
They also allow the status of the x87 FPU to be examined:
FINIT/FNINIT Initialize x87 FPU
FLDCW Load x87 FPU control word
FSTCW/FNSTCW Store x87 FPU control word
FSTSW/FNSTSW Store x87 FPU status word
FCLEX/FNCLEX Clear x87 FPU exception flags
FLDENV Load x87 FPU environment
FSTENV/FNSTENV Store x87 FPU environment
FRSTOR Restore x87 FPU state
FSAVE/FNSAVE Save x87 FPU state
FINCSTP Increment x87 FPU register stack pointer
FDECSTP Decrement x87 FPU register stack pointer
FFREE Free x87 FPU register
FNOP No operation
WAIT/FWAIT Check for and handle pending unmasked
x87 FPU exceptions
The FINIT/FNINIT instructions initialize the x87 FPU and its internal registers to
default values.
The FLDCW instructions loads the x87 FPU control word register with a value from
memory. The FSTCW/FNSTCW and FSTSW/FNSTSW instructions store the x87 FPU
error
fx() Fx()–
2
k63–
-------------------------- -
=
12
k–
fx() 2.<≤