Why do I need 17 significant digits (and not 16) to represent a double?

前端 未结 5 1517
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-29 08:55

Can someone give me an example of a floating point number (double precision), that needs more than 16 significant decimal digits to represent it?

I have found in thi

5条回答
  •  情话喂你
    2020-12-29 09:09

    Dig into the single and double precision basics and wean yourself of the notion of this or that (16-17) many DECIMAL digits and start thinking in (53) BINARY digits. The necessary examples may be found here at stackoverflow if you spend some time digging.

    And I fail to see how you can award a best answer to anyone giving a DECIMAL answer without qualified BINARY explanations. This stuff is straight-forward but it is not trivial.

提交回复
热议问题