in reply to adding numbers and floating point errors
Decimal fractions are rarely representable exactly in computing memory.
To prevent errors from building up, round more often.
As for
3.65 + 0.05 = 3.69999999999999I wouldn't say the error is in the first place. It's actually in the last place you showed. Any prior rounding would work. If the difference was significant in the first digit, you could round in the second place without getting the correct answer.
Decimals tie people in knots even when computers aren't involved. I remember a heated discussion in a math class I took, where the teacher was making no headway in convincing some student that .3 repeating is 1/3.
Phil
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: adding numbers and floating point errors
by smeenz (Sexton) on Nov 22, 2006 at 22:00 UTC |