Float division by 0 in not always Infinity
rubyTurns out this is expected behavior:
1.0 / 0.0
=> Infinity
0.0 / 0.0
=> NaN
Because Ruby follows IEEE 754:
- Invalid operation: mathematically undefined, e.g., the square root of a negative number. By default, returns qNaN.
- Division by zero: an operation on finite operands gives an exact infinite result, e.g., 1/0 or log(0). By default, returns ±infinity.