Hi all,
Math is not my strongest area so forgive me if I use some of the wrong
terminology.
It seems that scientific notation is immune to rounding errors. For
example:
(4.98 * 100) + 5.51 // returns 503.51000000000 005, rounding error!
4.98e2 + 5.51 // returns 503.51, correct!
Why are scientific notation numbers not affected? And if this is true,
does this mean that scientific notation would be safe to use in a
floating-point addition function?
For example, 4.98 + 0.2, which comes out to 5.1800000000000 01
(incorrect!), would become (498e2 + 0.2e2) / 1e2, which comes out to
5.18 (correct!)
Any insight would be appreciated...
--
Joe
Math is not my strongest area so forgive me if I use some of the wrong
terminology.
It seems that scientific notation is immune to rounding errors. For
example:
(4.98 * 100) + 5.51 // returns 503.51000000000 005, rounding error!
4.98e2 + 5.51 // returns 503.51, correct!
Why are scientific notation numbers not affected? And if this is true,
does this mean that scientific notation would be safe to use in a
floating-point addition function?
For example, 4.98 + 0.2, which comes out to 5.1800000000000 01
(incorrect!), would become (498e2 + 0.2e2) / 1e2, which comes out to
5.18 (correct!)
Any insight would be appreciated...
--
Joe
Comment