Re: [理工] [計概]-IEEE 754
※ 引述《tool11 (:))》之銘言:
IEEE 754
8bit exponential
|-|--------|-----------------------|
1bit sign 23bit fraction
Normalization: value=(-1)^sign * ( 1 + 0.fraction ) * 2^(exponential - bias)
非正規化: value=(-1)^sign * ( 0 + 0.fraction ) * 2^(exponential - bias)
bias: 為了讓exponential可以存負值而使用的偏移值
Exponential有8bit 其中00000000表示整個IEEE 754的值為零
11111111表示underflow或overflow
在加上正負對分
所以 bias=(2^(Exp)-2)/2=2^(exp-1)-1=2^(8-1)-1=127
: 1.Please present (10110.100011)2 with the IEEE 754 standard format.
10110.100011 --> 正規化 1.0110100011 * 2^(4) 正規化就是變成1.xx * 2^y
所以sign=0 (因為是正數) fraction=0110100011(直接把1.去掉)
exp=4+127=131(10)=10000011(2)
IEEE 754: 1 10000011 01101000110000000000000 (末尾補足到全部32bit)
: 2.What is the decimal number presented by the following IEEE 754 format?
: 0 10000011 11000000000000000000000
sign : 0
exp : 10000011(2)=131(10)
fraction: 11000000000000000000000
value=(-1)^sign * ( 1 + 0.fraction ) * 2^(exp-bias)
value=(-1)^0 * (1 + 0.11000000000000000000000 ) * 2^(131-127)
=1.11*2^4
=11100(2)=28(10)
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.39.172.115
※ 編輯: sodas2002 來自: 114.39.172.115 (02/24 08:15)
→
02/24 11:23, , 1F
02/24 11:23, 1F