This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread 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...