When is 0 <> 0 ?

spleve

Board Regular
Joined
Jun 3, 2003
Messages
106
A: When you add it in excel!

Example: Place the following values in a column and sum them.

-116.33
98.53
17.80
0
=============
Excel returns: 0.0000000000000035527136788005

Correct Answer: 0

If you remove 0 from the list ( or put it in a different place in the list, the proper result, 0 is returned.

I assume this has to do with the known floating point issues, but I've never seen an example where 0<>0, so I thought I'd share.

I have a workaround, but would love to see comments...
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Yeah, that floating point issues raises its ugly head in Access a lot too. I often use the ROUND function to avoid the problem (I round all my answers to 2 decimal places).
 
Upvote 0
I believe it is a hardware issue, not an Excel or Access issue. I too frequently see this in Access where calculations that should equal 0 do not. There is some history on this here on Wikipedia. Interestingly enough, if you rearrange the numbers from the OP such that the 0 is not the last number in the list, then the sum = 0. What is also interesting (IMO) is the history of zero, without which we wouldn't have computers.
My 2c
Andrew :)
 
Upvote 0
0<>0 occurs in other programs too

As well as Excel and Access, we've also seen these "mysterious" fractional values occur with data in our Paradox 3.5 (no, that's not a typo) from time to time. The rounding and delta comparing are ways we get around this issue too, but it would be a whole lot easier if we didn't need to do that, of course.

Compound that issue with receiving data from multiple sources that deals with rounding fractional cents at different points in the process, and welcome to my nightmare!

Great discussion topic... if it helps just one person realize they are not going insane, then our efforts are worth it. ;)

-SharonFinLV
 
Upvote 0
  • While fp errors were not new to me, I had no idea that input sequence or parenthesis use could impact the output. A very interesting find.
  • I must add that I'm impressed that spleve managed to get both Chip and Harlan to respond on the same thread.
 
Upvote 0
Well the good news is I feel very informed now.

The bad news is I have no idea how I will ever need this information :lol: .

But hey, you never know :-D
 
Upvote 0

Forum statistics

Threads
1,222,721
Messages
6,167,841
Members
452,149
Latest member
gatje

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top