This week's book giveaways are in the iOS and Features new in Java 8 forums. We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line! See this thread and this one for details.

... On the other hand, if the value of the divisor in an integer division is 0, then an ArithmeticException is thrown. [...] The result of a floating-point division is determined by the specification of IEEE arithmetic: ... - Division of a nonzero finite value by a zero results in a signed infinity. [...] Despite the fact that overflow, underflow, division by zero, or loss of information may occur, evaluation of a floating-point division operator / never throws a run-time exception.

[ July 18, 2002: Message edited by: Valentin Crettaz ]

____________________________________________ float f = 3.0f; float g = f/0; //will not throw any ArithmeticException and g's value will be NaN ________________________________________________ Isnt the value of this Infinity ??? and it would be NaN if it was float f = 0.0f; float g = f/0; Deepali

Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610

posted

0

you're right Deepali... I'm sorry the result of float f = 3.0f; float g = f/0; is Infinity and not NaN...