The draft IEEE 754r standard proposes an encoding format for decimal floating point numbers in which the significand and the exponent (and the payloads of NaNs) can be encoded in two ways, referred to in the draft as binary encoding and decimal encoding.[1].
Format
A finite number using the binary encoding has three fields, the sign, the exponent, and the significand.
If the top bits of the exponent are less than or equal to binary 1110:
s = +1 (positive numbers) when the sign bit is 0
s = −1 (negative numbers) when the sign bit is 1
e = exponent − bias
m = significand.
The number has the value:
v = s × 10e × m
The exponent and significand are stored as binary integers.
If the top five bits of the exponent field has the encoding 11110 binary, the number represents + or - infinity, the sign bit determines which. Nan is represented by the tops five bits of the exponent field being set to 11111.
Cohort
A decimal floating point number can be encoded in several ways, the different ways represent different precisions, for example 100.0 is encoded as 1000*10-1, 100.00 is encoded as 10000*10-2. The set of possible encodings of the same numerical value is called a cohort in the standard. If the result of a calculation is inexact the largest amount of significant data is preserved by selecting the cohort member with the largest integer that can be stored in the significand along with the required exponent.
Range
The proposed IEEE 754r standard limits the range of numbers to a significand of the form 10n−1, where n is the number of whole decimal digits that can be stored in the bits available so that decimal rounding is effected correctly.
item | 32 bit | 64 bit | 128 bit |
---|---|---|---|
Storage bits | 32 | 64 | 128 |
Trailing Significand bits | 20 | 50 | 110 |
Significand bits | 23 | 53 | 113 |
Combination bit | 11 | 13 | 17 |
Exponent bits | 8 | 10 | 14 |
Bias | 101 | 398 | 6176 |
Standard emax | 96 | 384 | 6144 |
Standard emin | 95 | 383 | 6143 |
Performance
A binary encoding is inherently less efficient for conversions to or from decimal-encoded data, such as strings (ASCII, Unicode, etc.) and BCD. A binary encoding is therefore best chosen when the data are binary rather than decimal. IBM has published some unverified performance data at [1], however as both packages are available as open-source these figures could be verified indepedently.
See Also
References
- ^ "DRAFT Standard for Floating Point Arithmetic P754" (PDF). 2006-10-04. Retrieved 2007-07-01.