frin.
Floating Round to Integer Nearest (Record)
frin. FRT,FRB
Rounds the floating-point operand in register FRB to an integral value using the rounding mode round to nearest.
Encoding
Binary Layout
18
0:5
FRT
6:29
FRB
30
Rc
31
Operands
-
FRT
Target Floating-Point Register -
FRB
Source Floating-Point Register
Example
frin f1, f3
Registers Altered
FPSCR, (FPRF, FX, VXSNAN), FPSCR, (FR, FI), CR1, (if, Rc=1), CR0Related
More in Floating-Point
Reference
View in PowerISA v3.1C Specification ↗
OPF Power ISA v3.1C
Description
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.
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.