0

I was reading this SO question on the biggest integer than can be stored in a double and I have a related question.

The Wikipedia article on double states that:

Between 2^52=4,503,599,627,370,496 and 2^53=9,007,199,254,740,992 the representable numbers are exactly the integers. For the next range, from 2^53 to 2^54, everything is multiplied by 2, so the representable numbers are the even ones, etc. Conversely, for the previous range from 2^51 to 2^52, the spacing is 0.5, etc.

The spacing as a fraction of the numbers in the range from 2^n to 2^(n+1) is 2^(n−52).

Assuming the information above is correct, and wrt the other SO question, can I take it that below 2^53, the integer part of a double will not lose precision?

I need to handle (as in perform arithmetic operations on) large real numbers (below 2^53) storing them as a double and am willing to lose precision in the fractional part but not in the integer part. Hence the question.

jamadagni
  • 1,214
  • 2
  • 13
  • 18

0 Answers0