+ 7

[Why] java any logical reason behind this concpet

as int a=3/0; // output is arithmetic exception: why not infinity; double b=3.0/0; //output is infinity: why not arithmetic exception;

11th Mar 2018, 5:49 PM
Nitish kumar jha
Nitish kumar jha - avatar
1 Answer
+ 8
The simple answer is a double is a floating point number and complies with the IEEE 754 standard for floating point arithmetic, which states: >The value of this constant is the result of dividing a positive {or negative} number by zero.
11th Mar 2018, 6:12 PM
David Carroll
David Carroll - avatar