java - Dividing 1.0/0.0: output is infinity -
this question has answer here:
double d=1.0/0.0; output infinity
double d=1/0; output arithmeticexception.
what difference between between these two? meaning of infinity here?
the first case treated division on double , later division on int , hence arthimeticexception.
here infinity means
http://docs.oracle.com/javase/7/docs/api/java/lang/double.html#positive_infinity
the division of doubles , floats per ieee 754 standards floating point match shouldnt throw exception.
Comments
Post a Comment