课程

教学相长

认真教书,认真学习

第一章 概述
第二章 Nios II处理器体系结构
第三章 Avalon接口规范
第四章 SOPC软硬件开发平台
第五章 Nios II处理器常用外设
第六章 μC/OS II操作系统移植
第七章 Nios II系统深入设计
第八章 调试技术

Single-precision floating-point forma

Single-precision floating-point format is a computer number format that occupies 4 bytes (32 bits) in computer memory and represents a wide dynamic range of values by using a floating point.

In IEEE 754-2008 the 32-bit base 2 format is officially referred to as binary32. It was called single in IEEE 754-1985. In older computers, different floating-point formats of 4 bytes were used, e.g. GW-BASIC's single-precision data type was the 32-bit MBF floating-point format.

The IEEE 754 standard specifies a binary32 as having:

The true significand includes 23 fraction bits to the right of the binary point and an implicit leading bit (to the left of the binary point) with value 1 unless the exponent is stored with all zeros. Thus only 23 fraction bits of the significand appear in the memory format but the total precision is 24 bits (equivalent to log10(224) ≈ 7.225 decimal digits). The bits are laid out as follows:


The real value assumed by a given 32 bit binary32 data with a given biased exponent e (the 8 bit unsigned integer) and a 23 bit fraction is = (-1)^\text{sign}(1.b_{22}b_{21}...b_{0})_2 \times 2^{e-127} where more precisely we have \text{value} = (-1)^\text{sign}\left(1 + \sum_{i=1}^{23} b_{23-i} 2^{-i} \right)\times 2^{(e-127)}.

In this example:

  • \text{sign} = 0
  • 1 + \sum_{i=1}^{23} b_{23-i} 2^{-i} = 1 + 2^{-2} = 1.25
  • 2^{(e-127)} = 2^{124-127} = 2^{-3}

thus:

  • \text{value} = 1.25 \times 2^{-3} = 0.15625