View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Jerry W. Lewis Jerry W. Lewis is offline
external usenet poster
 
Posts: 837
Default Sum does not sum to zero - leaves very small remainder

Excel (and almost all other software) does binary math. In binary, the only
2-decimal fractions that can be exactly represented are .00, .25, .50, and
..75. All other 2-decimal fractions can only be approximated as a binary
fraction, just as 1/3 can only be approximated as a decimal fraction.

In 4-figure finite precision decimal, 1 - 1/3 -1/3 -1/3 would be 1 -0.3333
-0.3333 -0.3333 = 0.0001. In the same way, when you do finite precision
binary math, there can be predictable minor departures from infiinte
precision, such as you have seen.

Since the issue is approximations to binary numbers that need infinite
precision to represent exactly, and since you are only adding and subtracting
2-decimal fractions, rounding results to 2 decimal places does no violence to
the calculations and can avoid the impact of the binary approximations.

Jerry

"Michael" wrote:

Hi,
I'm using SUM on a large spreadsheet of dollar type amounts that should only
have information to 2 decimal places and should sum to zero.

The problem is the sum function sums to a small remainder - in this case :

0.000000000069121597334742500000

I've looked at each value and none of them have any decimal values greater
than 2 decimal places.

Any ideas about why this is occuring ?

Regards
Michael