Can a IEEE 754 real number “cover” all integers within its range?

前端 未结 4 1579
死守一世寂寞
死守一世寂寞 2020-11-30 08:44

The original question was edited (shortened) to focus on a problem of precision, not range.

Single, or double precision, every representation of real number

4条回答
  •  遥遥无期
    2020-11-30 09:15

    macias, to add to the already excellent answer by phant0m (upvoted; I suggest you accept it), I'll use your own words.

    "No it cannot be done, for example number 16777217 is not represented exactly by float number."

    Also, "for example number 9223372036854775809 is not represented exactly by double number".

    This is assuming your computer is using the IEEE floating point format, which is a pretty strong bet.

提交回复
热议问题