ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   SUM OF NUMBERS APPEAR INCORRECT? (https://www.excelbanter.com/excel-discussion-misc-queries/219811-sum-numbers-appear-incorrect.html)

JEV

SUM OF NUMBERS APPEAR INCORRECT?
 
EXCEL 2003

30,625.010000000000000000000000000000
(30,570.020000000000000000000000000000)

54.989999999998

Why does the sum of these 2 numbers yield the answer shown? The answer is
being compared to the following separate sum below and is yeilding a
different answer as well. The 2 numbers being added or subtracted are not
calculated- they're entered manually.

=15340-15285.01
54.990000000000

If the answer to the second equation is formatted out to more than 12 places
you get something less than the 54.99 I would have expected in both instances.

Appreciate your insight.

Gary''s Student

SUM OF NUMBERS APPEAR INCORRECT?
 
This is simple rounding error. If you require a precise calculate to two
decimal digits, then use the =ROUND() function.
--
Gary''s Student - gsnu200832


"JEV" wrote:

EXCEL 2003

30,625.010000000000000000000000000000
(30,570.020000000000000000000000000000)

54.989999999998

Why does the sum of these 2 numbers yield the answer shown? The answer is
being compared to the following separate sum below and is yeilding a
different answer as well. The 2 numbers being added or subtracted are not
calculated- they're entered manually.

=15340-15285.01
54.990000000000

If the answer to the second equation is formatted out to more than 12 places
you get something less than the 54.99 I would have expected in both instances.

Appreciate your insight.


Bernard Liengme

SUM OF NUMBERS APPEAR INCORRECT?
 
Excel, and most other computer apps, follow the IEEE convention to store
digital numbers (number to base 10 that we use because we have 10 fingers)
as binary numbers (numbers to base 2, because a compute memory state is
either ON or OFF). This results is round-off errors like the one you found.

Work around: =ROUND(A1-B1,12) to round to 12 places

Note that there is seldom any good reason to work with more than 12 decimal
places; there are few things even a scientist can measure with that
precision.


More details on IEEE 754:
Chip's clear explanation
http://www.cpearson.com/excel/rounding.htm

Floating-point arithmetic may give inaccurate results in Excel
http://support.microsoft.com/kb/78113/en-us

(Complete) Tutorial to Understand IEEE Floating-Point Errors
http://support.microsoft.com/kb/42980

What Every Computer Scientist Should Know About Floating Point
http://docs.sun.com/source/806-3568/ncg_goldberg.html
http://www.cpearson.com/excel/rounding.htm

Visual Basic and Arithmetic Precision
http://support.microsoft.com/default...NoWebContent=1

Others:
http://support.microsoft.com/kb/214118

http://docs.sun.com/source/806-3568/ncg_goldberg.html

--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"JEV" wrote in message
...
EXCEL 2003

30,625.010000000000000000000000000000
(30,570.020000000000000000000000000000)

54.989999999998

Why does the sum of these 2 numbers yield the answer shown? The answer is
being compared to the following separate sum below and is yeilding a
different answer as well. The 2 numbers being added or subtracted are not
calculated- they're entered manually.

=15340-15285.01
54.990000000000

If the answer to the second equation is formatted out to more than 12
places
you get something less than the 54.99 I would have expected in both
instances.

Appreciate your insight.





All times are GMT +1. The time now is 07:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com