2009/2/2 Greg L <greg_l_at_wikipedia(a)comcast.net>et>:
Let me try that again since I mangled the last
response:
Sure. And my expectation that 5 divided by 3 times 3 ought to equal 5
and not 4.9999998 is due to my relative understanding of math and
relative lack of understanding regarding the inner workings of common
calculators. Is there some downside to fixing rounding errors in math
functions? If so, then we might as well throw up our hands that trying
to delimit numbers via math functions is a lost cause.
It's not a rounding error, but effect of finite-length binary
representation. If you 'fix' floating point arithmetic in way that
4.9999998 will be 5 you will fuck all other computations in which it
will be precise result.
If you really want to see such thing always use round() function ;)
You should remember that probably many compilers will simplyfy
expression '5/3*3' into '5' :)
AJF/WarX