โญ๏ธ ้้ป ๐็ฏไพ ๐ ๅ่ ๐ ๆๅ ๐ ๅทฅๅ
ท
all division have floating-point results.
The exponent is an 11-bit from 0 to 2047, in biased form : an exponent value of 1023 represents the actual zero . Exponents range from โ1022 to +1023 because exponents of โ1023 (all 0s) and +1024 (all 1s) are reserved for special numbers .
๐ Wikipedia
Copy // ๅฎ็ฒพๅบฆๆตฎ้ปๆธ
sign
โโญโexpโโโฎโญโโโโโโ fraction โโโโโโโฎ
001111100010000000000000000000000 = n
โโฐโ 8 - bitโฏโฐโโโโโโโ 23 - bit โโโโโโโโฏ
โญ๏ธ sign โด โฑ exp โญ๏ธ โฑ fraction โญ๏ธ
n = ( - 1 ) ^ sign * 2 ^ [exp - ( 01111111 )โ] * [ 1 + ( .01 )โ]
= 1 * 2 ^ ( - 3 ) * ( 1 + 1 / 4 )
= 1 * 0.125 * 1.25
= 0.15625
// ้็ฒพๅบฆๆตฎ้ปๆธ (double precision)(64-bit)
sign : 0 -> + , 1 -> -
exp : - 1022 ~ 1023 ( 2 ^ 1024 โ 1.8 * 10 ^ 308 )
frac : aโ( 2 )ยฏยน + aโ( 2 )ยฏยฒ + ... + aโ
โ( 2 )ยฏโตยฒ
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
// โ n = (-1)^sign * 2^[exp - (01111111111)โ] * (1 + fraction) โ
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
sign
โ โญโโ exp โโโฎ โญโโโโโโโโโโโโโโโโโโโโโ fraction โโโโโโโโโโโโโโโโโโโโฎ
0 10000000000 0100000000000000000000000000000000000000000000000000
โฐโโ 11 - bitโโฏ โฐโโโโโโโโโโโโโโโโโโโโโโ 52 - bit โโโโโโโโโโโโโโโโโโโโโฏ
= ( - 1 )โฐ * 2 ^ [( 10000000000 )โ - ( 01111111111 )โ] * ( 1.01 )โ
= 1 * 2 * ( 1.25 )
= 2.5
Copy โโโโโโโโโโโโโโโโโโโโ
โ Number.MAX_VALUE โ
โโโโโโโโโโโโโโโโโโโโ
2ยนโฐยฒยณ 2โนโทยน
โ โ
= 1.1111111111111111111111111111111111111111111111111111 * 2ยนโฐยฒยณ
โฐโโโโโโโโโโโโโโโโโโโโ 52-bit โโโโโโโโโโโโโโโโโโโโโโโฏ
= 1.7976931348623157e+308
โ 2ยนโฐยฒโด