Nios II Custom Instruction User Guide

ID 683242
Date 4/27/2020
Public
Document Table of Contents

5.2.2. Floating Point Value Encoding

The table below shows how single-precision values are encoded across the 32-bit range from 0x0000_0000 to 0xffff_ffff. Single-precision floating point numbers have the following characteristics:

  • Precision (ρ) = 24 bits (23 bits in FRAC plus one hidden bit)
  • Radix (β) = 2
  • emin = -126
  • emax = 127

The most-significant bit of FRAC is 0 for signaling NaNs (sNaN) and 1 for quiet NaNs (qNaN).

Table 10.  Encoding of Values
Hexadecimal Value Name S EXP FRAC Value (Decimal)
0x0000_0000 +0 0 0x00 0x00_0000 0.0
0x0000_0001 min pos subnormal 0 0x00 0x00_0001 1.40129846e–45 (βemin-ρ+1 = 2-126-24+1 = 2-149)
0x007f_ffff max pos subnormal 0 0x00 0x7f_ffff 1.1754942e-38
0x0080_0000 min pos normal 0 0x01 0x00_0000 1.17549435e–38 (βemin = 2-126)
0x3f80_0000 1 0 0x7f 0x00_0000 1.0 (1.0x20)
0x4000_0000 2 0 0x80 0x00_0000 2.0 (1.0x21)
0x7f7f_ffff max pos normal 0 0xfe 0x7f_ffff 3.40282347e+38 ((β – β1- ρ) * 2emax = (2 – 21-24) * 2127 = (2 – 223) * 2127
0x7f80_0000 +∞ 0 0xff 0x00_0000  
0x7f80_0001 min sNaN (pos sign) 0 0xff 0x00_0001  
0x7fdf_ffff max sNaN (pos sign) 0 0xff 0x3f_ffff  
0x7fe0_0000 min qNaN (pos sign) 0 0xff 0x40_0000  
0x7fff_ffff max qNaN (pos sign) 0 0xff 0x7f_ffff  
0x8000_0000 -0 1 0x00 0x00_0000 -0.0
0x8000_0001 max neg subnormal 1 0x00 0x00_0001 -1.40129846e–45
0x807f_ffff min neg subnormal 1 0x00 0x7f_ffff -1.1754942e-38
0x8080_0000 max neg normal 1 0x01 0x00_0000 -1.17549435e–38
0xff7f_ffff min neg normal 1 0xfe 0x7f_ffff -3.40282347e+38
0xff80_0000 -∞ 1 0xff 0x00_0000  
0xff80_0001 max sNaN (neg sign) 1 0xff 0x00_0001  
0xffdf_ffff min sNaN (neg sign) 1 0xff 0x3f_ffff  
0xffe0_0000 max qNaN (neg sign) 1 0xff 0x40_0000  
0xffff_ffff min qNaN (neg sign) 1 0xff 0x7f_ffff