By kbilsted
via firstclassthoughts.co.uk
Published: Jul 10 2008 / 07:22
You're in for some "Double trouble"! This article is a practical guide to describing the major traps and pitfalls associated with using the Javas simple type double. It is a must-read for any professional developer
Comments
mheath replied ago:
This isn't limited to Java. The floating point unit in your CPU behaves the same way. This is the way that IEEE 754 floating point works. http://en.wikipedia.org/wiki/IEEE_754
apolci replied ago:
I agree with mheath.
With a different title the article would be a good one.
kbilsted replied ago:
So its in the IEEE specification that 0/0 should throw an exception while 0.0 / 0.0 shouldn't? I'm not too sure about that!
However, that being said, you are correct a lot of the problems illustrated are tied to IEEE 754, but then again not really. They are tied to the fact that a computer cannot represent all numbers 0.0 - 255.0 while it has no problems representing the numbers 0 - 255.
Voters For This Link (15)
Voters Against This Link (2)