ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Rounding error is conditional on brackets (https://www.excelbanter.com/excel-discussion-misc-queries/175498-rounding-error-conditional-brackets.html)

JasonG

Rounding error is conditional on brackets
 
If I put these values and formulae, I get a zero total, which is what I expect

a1: 123.456
a2: 234.567
a3: 358.023

=a3-a2-a1 (gives zero exactly)

If I put this, I get a rounding error:

=(a3-a2-a1) (gives 1.42e-14)

In another spreadsheet, the error was much larger (2e-9).

Excel should give the same result either way, but it doesn't.

Does anyone know why?

Jason

Pete_UK

Rounding error is conditional on brackets
 
A very common question. It is to do with the way Excel stores
fractional values, as most decimal fractions cannot be represented
accurately in binary. Take a simple decimal example, using 2 dp:

x = 1/3 = 0.33

x + x + x = 0.33 + 0.33 + 0.33 = 0.99

which is not equal to 1.

Pete

On Feb 4, 5:08*pm, JasonG wrote:
If I put these values and formulae, I get a zero total, which is what I expect

a1: 123.456
a2: 234.567
a3: 358.023

=a3-a2-a1 * *(gives zero exactly)

If I put this, I get a rounding error:

=(a3-a2-a1) * (gives 1.42e-14)

In another spreadsheet, the error was much larger (2e-9).

Excel should give the same result either way, but it doesn't.

Does anyone know why?

Jason



Niek Otten

Rounding error is conditional on brackets
 
Hi Jason,

Look he

http://support.microsoft.com/kb/78113

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"JasonG" wrote in message ...
| If I put these values and formulae, I get a zero total, which is what I expect
|
| a1: 123.456
| a2: 234.567
| a3: 358.023
|
| =a3-a2-a1 (gives zero exactly)
|
| If I put this, I get a rounding error:
|
| =(a3-a2-a1) (gives 1.42e-14)
|
| In another spreadsheet, the error was much larger (2e-9).
|
| Excel should give the same result either way, but it doesn't.
|
| Does anyone know why?
|
| Jason




All times are GMT +1. The time now is 09:50 PM.

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