Forum Discussion
Limit in the precision of big integers as output of a formula
- Sep 10, 2022
There is a lot of misinformation about this, so pay close attention. Anyone who says that Excel "stores" only 15 significant digits does not know what they are talking about -- and that includes MSFT(!).
(Note: Not intended to reflect on HansV. I had not seen his posting until after I submitted mine. Yes, I'm that slow. sigh.)
The fact is, =900000000000000 +199999999999998 does indeed result in 1099999999999998, as does your formula =10^(AD1/2+1)+10^(AD1/2)-2 with AD1=28.
To demonstrate, with that formula in A1, enter formula =SUM(A1,-1099999999999990). The result is 8.
(Caveat: In general, we cannot write simply =A1-1099999999999990 for others reasons. But actually, that does work as expected in this case, only by coincidence.)
But Excel formats only the first 15 significant digits (rounded), replacing any digits to the right with zero. So the result appears to be 1100000000000000.
Also, when we enter a number, Excel interprets only the first 15 significant digits, replacing any digits to the right with zero -- effectively truncating, not rounding.
Excel can exactly calculate all integers from 0 to 9007199254740992 (2^53).
It can also represent some larger integers exactly, namely any integer that can be represented as the sum of 53 consecutive powers of 2.
Everything else is approximated by the sum of 53 consecutive powers of 2.
But beware: just because the end result of a calculation might be within the limitations above mathematically, we might lose precision if any part of the calculation exceeds them.
Also note that most decimal fractions cannot be represented exactly as the sum of 53 consecutive powers of 2; so the binary representation is an approximation. Moreover, the binary approximation of a particular decimal fraction might vary depending on the magnitude of the number. That is why, for example, 10.01 - 10 = 0.01 returns FALSE(!).
That can affect calculations with decimal fractions that result in integers mathematically, but maybe not in Excel (and most applications). For example, 100*32.8 is not exactly 3280. That is, 100*32.8-INT(3280)=0 returns FALSE(!).
(Caveat: Although 100*32.8=INT(3280) returns TRUE for other reasons.)
There is a lot of misinformation about this, so pay close attention. Anyone who says that Excel "stores" only 15 significant digits does not know what they are talking about -- and that includes MSFT(!).
(Note: Not intended to reflect on HansV. I had not seen his posting until after I submitted mine. Yes, I'm that slow. sigh.)
The fact is, =900000000000000 +199999999999998 does indeed result in 1099999999999998, as does your formula =10^(AD1/2+1)+10^(AD1/2)-2 with AD1=28.
To demonstrate, with that formula in A1, enter formula =SUM(A1,-1099999999999990). The result is 8.
(Caveat: In general, we cannot write simply =A1-1099999999999990 for others reasons. But actually, that does work as expected in this case, only by coincidence.)
But Excel formats only the first 15 significant digits (rounded), replacing any digits to the right with zero. So the result appears to be 1100000000000000.
Also, when we enter a number, Excel interprets only the first 15 significant digits, replacing any digits to the right with zero -- effectively truncating, not rounding.
Excel can exactly calculate all integers from 0 to 9007199254740992 (2^53).
It can also represent some larger integers exactly, namely any integer that can be represented as the sum of 53 consecutive powers of 2.
Everything else is approximated by the sum of 53 consecutive powers of 2.
But beware: just because the end result of a calculation might be within the limitations above mathematically, we might lose precision if any part of the calculation exceeds them.
Also note that most decimal fractions cannot be represented exactly as the sum of 53 consecutive powers of 2; so the binary representation is an approximation. Moreover, the binary approximation of a particular decimal fraction might vary depending on the magnitude of the number. That is why, for example, 10.01 - 10 = 0.01 returns FALSE(!).
That can affect calculations with decimal fractions that result in integers mathematically, but maybe not in Excel (and most applications). For example, 100*32.8 is not exactly 3280. That is, 100*32.8-INT(3280)=0 returns FALSE(!).
(Caveat: Although 100*32.8=INT(3280) returns TRUE for other reasons.)
- ericEGBSep 10, 2022Copper ContributorMany thanks, Joe User ! Your answer is very clear and accurate! I've just to figure out how I'll be able to obtain a view with the right precision.