课程

教学相长

认真教书,认真学习

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

Denormal number

In computer science, denormal numbers or denormalized numbers (now often called subnormal numbers) fill the underflow gap around zero in floating-point arithmetic. Any non-zero number with magnitude smaller than the smallest normal number is 'subnormal'.

In a normal floating-point value, there are no leading zeros in the significand; instead leading zeros are moved to the exponent. So 0.0123 would be written as 1.23 × 10−2. Denormal numbers are numbers where this representation would result in an exponent that is below the minimum exponent (the exponent usually having a limited range). Such numbers are represented using leading zeros in the significand.

The significand (or mantissa) of an IEEE floating point number is the part of a floating-point number that represents the significant digits. For a positive normalised number it can be represented as m0.m1m2m3...mp-2mp-1 (where m represents a significant digit and p is the precision, and m0 is non-zero). Notice that for a binary radix, the leading binary digit is always 1. In a denormal number, since the exponent is the least that it can be, zero is the leading significand digit (0.m1m2m3...mp-2mp-1), allowing the representation of numbers closer to zero than the smallest normal number.

By filling the underflow gap like this, significant digits are lost, but not as abruptly as when using the flush to zero on underflow approach (discarding all significant digits when underflow is reached). Hence the production of a denormal number is sometimes called gradual underflow because it allows a calculation to lose precision slowly when the result is small.

In IEEE 754-2008, denormal numbers are renamed subnormal numbers, and are supported in both binary and decimal formats. In binary interchange formats, subnormal numbers are encoded with a biased exponent of 0, but are interpreted with the value of the smallest allowed exponent, which is one greater (i.e., as if it were encoded as a 1). In decimal interchange formats they require no special encoding because the format supports unnormalized numbers directly.

Mathematically speaking, the normalized floating point numbers of a given sign are roughly logarithmically spaced, and as such any finite-sized normal float cannot include zero. The denormal floats are a linearly-spaced set of values which span the gap between the negative and positive normal floats.

非规格化浮点数

非规格化浮点数(denormal number,a.k.a. subnormal number)是指的计算机中处理的一类特殊浮点数。在规格化浮点数中,浮点数的尾数不应当包含前导0。如果全部用十进制表示,对于类似0.0123的浮点数,规格化的表示应为1.23e-2。但对于某些过小的数,如1.23e-130,允许的阶数位数不能满足阶数大小的需要,这时可能就会在尾数前添加前导0,如将其表示为0.000123e-126。

 

IEEE754-2008中,非规格化浮点数(denormal number)被称作subnormal number。该标准支持对十进制和二进制非规格化浮点数的运算。[1]  尽管如此,不同的软件与硬件系统对非规格化浮点数运算的支持程度与方式不同。一些硬件系统直接支持非规格化浮点数操作,而英特尔的SSE2指令集直接将非规格化浮点数四舍五入至0。其它一些环境下非规格化浮点数的操作由软件处理。一般来说,由软件对非规格化浮点数进行处理将带来极大的性能损失,而由硬件处理的情况会稍好一些,但在多数现代处理器上这样的操作仍是缓慢的。极端情况下,规格化浮点数操作可能比硬件支持的非规格化浮点数操作快 100倍。

非规格化浮点数在允许浮点误差的前提下,可以使任何浮点运算可以在任何浮点数上操作,而不产生下溢出异常,但另一方面它也可能导致更多的除以0错误和NaN的出现。因此,在8087及其它一些CPU上实现非规格化浮点数曾受到争议。