IEEE floating point format
Bob Knighten
knighten at pinocchio
Sat Jul 29 04:05:39 AEST 1989
Single format: Numbers in the single format are composed of three fields:
A 1-bit sign S
A biased exponent e = exponent + 127
A fraction f = 0.b b ...b
1 2 23
The exponent range is -126 to +127. Exponent = 128 is used to encode
+/-infinity and NaNs. Exponent = -127 is used to encode +/-0 and denormalized
numbers.
The layout is:
1 8 23 width
|S| e | f |
m l m l order
where m stands for most significant bit
and l stands for least significant bit
Double format: Numbers in the single format are composed of three fields:
A 1-bit sign S
A biased exponent e = exponent + 1023
A fraction f = 0.b b ...b
1 2 52
The exponent range is -1022 to +1023. Exponent = 1024 is used to encode
+/-infinity and NaNs. Exponent = -1023 is used to encode +/-0 and denormalized
numbers.
The layout is:
1 11 52 width
|S| e | f |
m l m l order
where m stands for most significant bit
and l stands for least significant bit
The value of a number represented in either of these formats is
S exponent
x = (-1) * 1.f * 2
--
Bob Knighten
Encore Computer Corp.
257 Cedar Hill St.
Marlborough, MA 01752
(508) 460-0500 ext. 2626
Internet: knighten at encore.com
UUCP: {bu-cs,decvax,necntc,talcott}!encore!knighten
More information about the Comp.lang.c
mailing list