floating point - significant decimal digits of binary32 and binary64 -


accourding wikipedia binary32 format has 6 9 significant decimal digits precision , 64 format has 15 17.

i found these significant decimal digits have been calculated using mantissa didn't how can 1 calculate it? idea ?

mantissa of 32bit format = 24bits ,mantissa of 64bit format = 53bits

first, question better use total significand sizes 24 , 53. fact leading bit not represented aspect of encoding.

if interested in vague explanation, each decimal digit contains log2(10) (about 3.32) bits of information. when have encode 1 digit, need 4 bits, here talking encoding several consecutive decimal digits efficiently, figure of 3.32 do.

53 bits / log2(10) -> 15.95 (16ish decimal digits)

24 bits / log2(10) -> 7.22 (7ish decimal digits)

if want properly, need consider fact not same numbers representable in binary , in decimal. people ask decimal precision of binary floating-point assumed mean either decimal precision can round-trip through binary format , come same, or decimal precision necessary round-trip binary floating-point number through decimal same value, because these interpretations makes sense. hence ranges “6 … 9” , “15 … 17”. 6 number of decimal digits guaranteed round-trip through binary32, 9 number of decimal digits 1 needs retain round-trip binary32 number through decimal, , on.

the author of blog exploring binary writing series on round-trips. series should read next if not satisfied log2(10)=3.32 explanation.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -