Divide by zero is valid for floating point numbers.
- 1/0 yields Infinity.
- (-1)/0 yields -Infinity.
- 0/0 yields NaN.
These “numbers” are properly defined in IEEE 754.
Integer division by zero, on the other hand, throws because one cannot represent infinity as an int
.