Floating Point Numbers

IEEE Standard 754 Floating Point Numbers

Comparing floating point numbers

a tool: IEEE-754 Analysis

 

Float Values (b = bias)
SignExponent (e)Fraction (f)Value
0 00..00 00..00 +0
0 00..00 00..01
:
11..11
Positive Denormalized Real
0.f × 2(-b+1)
0 00..01
:
11..10
XX..XX Positive Normalized Real
1.f × 2(e-b)
0 11..11 00..00 +Infinity
0 11..11 00..01
:
01..11
SNaN
0 11..11 10..00
:
11..11
QNaN
1 00..00 00..00 -0
1 00..00 00..01
:
11..11
Negative Denormalized Real
-0.f × 2(-b+1)
1 00..01
:
11..10
XX..XX Negative Normalized Real
-1.f × 2(e-b)
1 11..11 00..00 -Infinity
1 11..11 00..01
:
01..11
SNaN
1 11..11 10..00
:
11.11
QNaN

 

对于单精度而言,超过2^24 - 1的数的整数部分精度就开始降低为2^(n-24), n为bit位数。

posted on 2011-12-25 19:58  lbsx  阅读(219)  评论(0编辑  收藏  举报