In Java, (Number/0) throws an ArithmeticException while (Number/0.0) = Infinity.
Why does this happen?
In Java, (Number/0) throws an ArithmeticException while (Number/0.0) = Infinity. Why does this happen?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Because IEEE-754 floating point numbers have a representation for infinity, whereas integers don’t.
In other words, every bit pattern in
intrepresents a normal integer; floating point values are rather more complicated with +/- infinity, “not a number” (NaN) values, normalized values, subnormal values etc.