What number in binary can only be represented as an approximation?

前端 未结 10 788
礼貌的吻别
礼貌的吻别 2021-01-16 12:10

In decimal (base 10), 1/3 can only be approximated to 0.33333 repeating.

What number is the equivalent in binary that can only be represented as an app

10条回答
  •  轮回少年
    2021-01-16 12:33

    In python 2.4:

    >>> 1.0 / 5.0
    0.20000000000000001
    

    That indicates that base 2 has a hard time representing it exactly.

提交回复
热议问题