frndint

Round to Integer

FRNDINT

Rounds ST(0) to integer according to RC field.

Details

Rounds the value in ST(0) to an integer according to the rounding control (RC) field in the FPU control word (bits 10–11). The result remains in ST(0) as a floating-point number with zero fractional part. This instruction does not pop the stack and does not set exception flags.

Pseudocode Operation

ST(0) ← round_to_integer(ST(0), RC_field)

Example

FRNDINT

Encoding

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

Operands

Reference (Intel® SDM)

Instruction Forms

Opcode Instruction Op/En 64/32-bit Mode CPUID Description
D9 FC FRNDINT Valid Valid Round ST(0) to an integer.

Description

Rounds the source value in the ST(0) register to the nearest integral value, depending on the current rounding mode (setting of the RC field of the FPU control word), and stores the result in ST(0). If the source value is ∞, the value is not changed. If the source value is not an integral value, the floating-point inexact-result exception (#P) is generated. This instruction’s operation is the same in non-64-bit modes and 64-bit mode.

Operation

ST(0) := RoundToIntegralValue(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.

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. FRNDINT—Round to Integer Vol. 2A 3-372