Home/Instructions/FROUNDNX-S
FROUNDNX.S

RISC-V FROUNDNX.S Instruction Details

Instruction ManualR-type

Round a single-precision floating-point value to an integral value in the same FP format, setting NX when required.

Instruction Syntax

froundnx.s rd, rs1, rm
Operand Breakdown
rd: destination floating-point register receiving the formatted result.
rs1/rs2: source floating-point registers; arithmetic/rounding forms with rm use rm or dynamic frm for rounding mode.
ZfaFFP Precision

Instruction Behavior

FROUNDNX.S rounds the single-precision floating-point value in f[rs1] to an integral value according to rm, but writes the result back to f[rd] in the same single-precision floating-point format. The FROUNDNX form sets NX when the result is inexact. A signaling NaN sets NV; quiet NaNs follow the floating-point NaN result rules.

Quick Understanding & Search Notes

FROUNDNX.S differs from FCVT by output type: FROUNDNX.S still writes a floating-point register, with the value rounded to an integral value. FROUNDNX also reports inexact NX.

rm selects the rounding direction, with frm supplying dynamic rounding.
Special values such as zero and infinity follow the Zfa rules; signaling NaNs still set NV.

Common Usage Scenarios

Floating-Point Rounding

Understand this scenario with real code like «froundnx.s f10, f11, rne ; round f11 with inexact detection».

Numeric Format Handling

Understand this scenario with real code like «froundnx.s f10, f11, rne ; round f11 with inexact detection».

Pre-Use Checklist

Syntax Check
  • Confirm the current instruction format is R-type.
  • Confirm the operand order matches the example.
Semantic Check
  • Ensure the destination register usage is compatible with the calling convention.
  • Confirm this is not the lower-level form of a pseudo-instruction expansion.

Pitfalls / Common Confusions

FROUNDNX sets NX when inexact; do not confuse it with FROUND, which does not set NX.
The result is still floating-point, not an integer-register result; use FCVT for an integer result.
rm controls the direction for rounding to an integral value.

FAQ

Does FROUNDNX.S write an integer register?

No. The result is written to floating-point register f[rd]; the floating-point value is integral.

How does FROUNDNX.S differ from the other FROUND form?

FROUNDNX sets NX when inexact; FROUND does not set NX.