This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.

Hey everyone! I love this site!!! This is my first post, so please be gentle ... I have a very straightforward question, but I'm not sure whether it is a basic question or an intermediate one. My question is why is there a difference between integers and floating points when there is a division by zero? Integer division results in an arithmetic exception, while floating point division results in either the constants Float.POSITIVE_INFINITY or Double.POSITIVE_INFINITY. Why not just pick one method and consistently apply it for both integers and floating points? Thanks, Dan

Because floats and doubles deal with decimals. To accurately track what a doubles value REALLY is you would need to have an infinite number of decimals. If you have a 0.0 double or float it is unknown if about a zillion decimal places out there might actually be a value that makes in "not exactly" zero. Therefore it MIGHT actually be a decimal value that is just VERY VERY SMALL or BIG. Thus the POSITIVE_INFINITY or NEGATIVE-INFINITY. With an integer there is NO doubt that you blew it, therefore the exception.

"JavaRanch, where the deer and the Certified play" - David O'Meara

Don't get me started about those stupid light bulbs.