Throw arithmeticexception in Java

In Java, (number / 0) throws an arithmeticexception, while (number / 0.0) = infinity

Solution

Because IEEE - 754 floating - point numbers have an infinite representation, while integers do not

In other words, each bit pattern in int represents a normal integer; Floating point values are more complex, including / – infinity, "non numeric" (Nan) values, standardized values, subnormal values, etc

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>