According to Wikipedia on the IEEE 64-bit floating point standard:
Between 252=4,503,599,627,370,496 and 253=9,007,199,254,740,992 the representable numbers are exactly the integers. For the next range, from 253 to 254, everything is multiplied by 2, so the representable numbers are the even ones, etc.
Does this mean contiguous integers can be represented up to 253?
In short I am trying to find the range of integer values upon which integer addition and subtraction operations will result in an exactly correct result.
Yes, all integers from -253 to +253, inclusive, are representable in IEEE-754 64-bit floating-point. An implementation that conforms to IEEE 754 will return exactly correct results for all operations a+b
and a-b
where a
, b
, and the mathematical result are integers in that interval.
Obviously, some results will be outside that interval, such as 253+1, so many operations that produce such results will produce a value that is not exact due to rounding to a representable value.
An interval such that a
and b
being integers in the interval guarantees that a+b
and a-b
are exact is -252 to +252, inclusive.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With