Java division by zero doesnt throw an ArithmeticException – why?
IEEE 754 defines 1.0 / 0.0 as Infinity and -1.0 / 0.0 as -Infinity and 0.0 / 0.0 as NaN. By the way, floating point values also have -0.0 and so 1.0/ -0.0 is -Infinity. Integer arithmetic doesn’t have any of these values and throws an Exception instead. To check for all possible values (e.g. … Read more