fsqrt

Square Root

FSQRT

Computes square root of ST(0).

Details

Computes the square root of ST(0) and replaces ST(0) with the result using extended-precision floating-point arithmetic. The x87 FPU C1 flag may be set based on stack conditions; other x87 status flags (C0, C2, C3) are updated according to the result. This is a transcendental operation with typical latency of 70–100 cycles.

Pseudocode Operation

ST(0) ← sqrt(ST(0))

Example

FSQRT

Encoding

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

Operands

Reference (Intel® SDM)

Instruction Forms

Opcode Instruction Op/En 64/32-bit Mode CPUID Description
D9 FA FSQRT Valid Valid Computes square root of ST(0) and stores the result in ST(0).

Description

Computes the square root of the source value in the ST(0) register and stores the result in ST(0). The following table shows the results obtained when taking the square root of various classes of numbers, assuming that neither overflow nor underflow occurs. Table 3-39. FSQRT Results SRC (ST(0)) DEST (ST(0)) − ∞ * − F * − 0 − 0 + 0 + 0 + F + F + ∞ + ∞ NaN NaN

Operation

ST(0) := SquareRoot(ST(0));

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. FSQRT—Square Root Vol. 2A 3-384

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. FSQRT—Square Root Vol. 2A 3-385