This week's book giveaway is in the Android forum.We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!See this thread for details.
Big Moose Saloon
 Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies Register / Login Win a copy of Head First Android this week in the Android forum!

# why dividing by 0.0 ( float ) dont give ArithmeticException

amit taneja
Ranch Hand

Joined: Mar 14, 2003
Posts: 810
Hi,
can any body tell me why dividing by 0.0 ( float ) dont give ArithmeticException ....

i don't find the proper reason in kethy sera book ...

** kethy sera /bert bates is wonderfull book but some info is missing.. i think...

Thanx and regards,
amit

Thanks and Regards, Amit Taneja
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Floating-point arithmetic -- as defined by the IEEE 754 standards -- provides special values for these situations: Infinity, Negative Infinity, or NaN (for "not a number").

[ January 19, 2005: Message edited by: marc weber ]

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
Floating point numbers are based on aproximations to real numbers. When you are doing calculations, this calculations might start making your numbers aproximate to 0, the numbers become every time smaller, but still bigger than 0. When the number cannot be stored because it is too small a gradual undeflow starts to happen... first Java makes an effort to store the number as a denormalized number and when finally nothing can be done it produces a negative o positive 0; that means an underflow.

So, when you are making operations with floats many things might happen and Java do not raise an Arithmetic exception as with Integers when you divide by zero. Because after all, you might have got a zero after another operation which could not calculate the small number you wanted to use and now everything will not fail just because jvm could not calculate the right number.
amit taneja
Ranch Hand

Joined: Mar 14, 2003
Posts: 810
Thanx a ton,

regards,
amit

I agree. Here's the link: http://aspose.com/file-tools

subject: why dividing by 0.0 ( float ) dont give ArithmeticException