搜档网
当前位置:搜档网 › IEEE标准754中英文

IEEE标准754中英文

IEEE标准754中英文
IEEE标准754中英文

如有你有帮助,请购买下载,谢谢!
几乎所有计算机都支持二进制数据表示,即能直接识别二进制数据表示并具 有相应的指令系统。通常采用的二进制定点数据表示主要有:符号数值、反码、 补码以及带偏移增值码四种形式,其中最常用的是补码形式,这些都已在计算机 组成原理课程中做了详细讨论,这里不再阐述。 二进制浮点数的表示,由于不同机器所选的基值、尾数位长度和阶码位长度不 同,因此对浮点数表示有较大差别,这就不利于软件在不同计算机间的移植。美 国 IEEE(电子及电子工程师协会)为此提出了一个从系统结构角度支持浮点数 的表示方法, 称之为 IEEE 标准754(IEEE,1985),当今流行的计算机几乎都采 用这一标准。
IEEE 754在标识符点数时, 每个浮点数均由3个部分组成:符号位 S,指数部 分 E 和尾数部分 M。 浮点数可采用以下四种基本格式: (1)单精度格式(32位):E=8位,M=23位。 (2)扩展单精度格式:E≥11位,M≥31位。 (3)双精度格式(64)位:E=11位,M=52位。 (4)扩展双精度格式(64位):E≥15位,M≥63位。 其中,单精度格式(32位)中的阶码为8位, 另有一位尾数的符号位 S,处在最高 位。如图,浮点数的分数部分与有效位部分两者是不同的, 由于 IEEE754标准 约定在小数点左部有一位隐含位,从而使其有效位实际有24位,这样便使尾数的 有效值变为1M。阶码部分采用移码表示, 移码值为127,从而使阶码值的范围 由原来的1到254,经移码后变为-126到+127。
IEEE 754标准的单精度和双精度浮点数表示格式。其中,阶码值0和255分别用 来表示特殊数值:当阶码值为255时,若分数部分为0,则表示无穷大;若分数部 分不为0,则认为这是一个‘非数值’。当阶码和尾数均为0时则表示该数值为0, 因为非零数的有效位总是≥1,因此特别约定,这表示为0。当阶码为0, 尾数不 为0时,该数绝对值较小, 允许采用比最小规格化数还要小的数表示。概括起来, 由32位单精度所表示的 IEEE 754标准浮点数 N 可以有如下的解释: 若 E=0,且 M=0,则 N 为0。 若 E=0,且 M≠0,则 N=(-1)S·2-126·(0.M)。为非规格化数。 若1≤E≤254,则 N=(-1)S·2E-127·(1.M)。为规格化数。 若 E=255,且 M≠0,则 N=NaN(‘非数值’)。 若 E=255,且 M=0,则 N=(-1)S∝(无穷大)。 由此可见, IEEE 754标准使0有了精确表示,同时也明确地表示了无穷大,所 以,当 a/0(a≠0)时得到结果值为±∞;当0/0时得到结果值较小的数,为了避免下 溢而损失精度,允许采用比最小规格化数还要小的数来表示,这些数称为非规格 化数(Denormalnumber)。应注意的是,非规格化数和正、负零的隐含位值不是1 而是0。 下面举两个例子来说明 IEEE 754标准浮点数的表示:
(1)N=-1.5,它的单精度格式表示为:
1 01111111 00000000
1页

如有你有帮助,请购买下载,谢谢!
其中,S=1,E=127,M=0.5,因此 N=-1.5。
(2)以下的32位数所表示的单精度浮点数为多少?
1 00000000
其中,S=1,E=129,M=0.25,由公式可知 N=-5。
IEEE Standard 754 floating point is the most common representation today for real numbers on computers, including Intel-based PC's, Macintoshes, and most Unix platforms. This article gives a brief overview of IEEE floating point and its representation. Discussion of arithmetic implementation may be found in the book mentioned at the bottom of this article.
What Are Floating Point Numbers?
There are several ways to represent real numbers on computers. Fixed point places a radix point somewhere in the middle of the digits, and is equivalent to using integers that represent portions of some unit. For example, one might represent 1/100ths of a unit; if you have four decimal digits, you could represent 10.82, or 00.01. Another approach is to use rationals, and represent every number as the ratio of two integers.
Floating-point representation - the most common solution - basically represents reals in scientific notation. Scientific notation represents numbers as a base number and an exponent. For example, 123.456 could be represented as 1.23456 x 102. In hexadecimal, the number 123.abc might be represented as 1.23abc x 162.
Floating-point solves a number of representation problems. Fixed-point has a fixed window of representation, which limits it from representing very large or very small numbers. Also, fixed-point is prone to a loss of precision when two large numbers are divided.
Floating-point, on the other hand, employs a sort of "sliding window" of precision appropriate to the scale of the number. This allows it to represent numbers from 1,000,000,000,000 to 0.0000000000000001 with ease.
Storage Layout
IEEE floating point numbers have three basic components: the sign, the exponent, and the mantissa. The mantissa is composed of the fraction and an implicit leading digit (explained below). The exponent base (2) is implicit and need not be stored.
2页

如有你有帮助,请购买下载,谢谢!
The following figure shows the layout for single (32-bit) and double (64-bit) precision floating-point values. The number of bits for each field are shown (bit ranges are in square brackets):
Single Precision
Double Precision
The Sign Bit
Sign 1 [31] 1 [63]
Exponent 8 [30-23] 11 [62-52]
Fraction 23 [22-00] 52 [51-00]
Bias 127 1023
The sign bit is as simple as it gets. 0 denotes a positive number; 1 denotes a negative number. Flipping the value of this bit flips the sign of the number.
The Exponent
The exponent field needs to represent both positive and negative exponents. To do this, a bias is added to the actual exponent in order to get the stored exponent. For IEEE single-precision floats, this value is 127. Thus, an exponent of zero means that 127 is stored in the exponent field. A stored value of 200 indicates an exponent of (200-127), or 73. For reasons discussed later, exponents of -127 (all 0s) and +128 (all 1s) are reserved for special numbers.
For double precision, the exponent field is 11 bits, and has a bias of 1023.
The Mantissa
The mantissa, also known as the significand, represents the precision bits of the number. It is composed of an implicit leading bit and the fraction bits.
To find out the value of the implicit leading bit, consider that any number can be expressed in scientific notation in many different ways. For example, the number five can be represented as any of these:
5.00 x 100 0.05 x 102 5000 x 10-3
In order to maximize the quantity of representable numbers, floating-point numbers are typically stored in normalized form. This basically puts the radix point after the first non-zero digit. In normalized form, five is represented as 5.0
3页

相关主题