frin

Floating Round to Integer Nearest

frin FRT,FRB
frin. FRT,FRB

Rounds the floating-point operand in register FRB to an integral value using the rounding mode round to nearest.

Details

The floating-point operand in register FRB is rounded to an integral value as follows, with the result placed into register FRT. If the sign of the operand is positive, (FRB) + 0.5 is truncated to an integral value, otherwise (FRB) - 0.5 is truncated to an integral value.

Pseudocode Operation

if 'frin' then
    if (FRB) >= 0 then
        FRT <- truncate((FRB) + 0.5)
    else
        FRT <- truncate((FRB) - 0.5)

Programming Note

These instructions set FR and FI to 0b00 regardless of whether the result is inexact or rounded because there is a desire to preserve the value of XX.

Example

frin f1, f3

Encoding

Binary Layout
18
0
FRT
6
FRB
30
Rc
31
 
Format X-form
Opcode 0xFC000310
Extension Floating-Point
Registers Altered FPSCR, (FPRF, FX, VXSNAN), FPSCR, (FR, FI), CR1, (if, Rc=1), CR0

Operands

  • FRT
    Target Floating-Point Register
  • FRB
    Source Floating-Point Register