This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.

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

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.