Javascript
0/0 // NaN
0/0.0 // NaN
1/0.0 // Infinity
1/0.0 // Infinity
红宝石
>> 0/0 # ZeroDivisionError: divided by 0
>> 0/0.00 # NaN
>> 1/0.00 # Infinity
>> -1/0.00 # -Infinity
Python
>>> 0/0 # ZeroDivisionError: integer division or modulo by zero
>>> 0/0.0 # ZeroDivisionError: integer division or modulo by zero
>>> 1/0.0 # ZeroDivisionError: integer division or modulo by zero
>>> -1/0.0 # ZeroDivisionError: integer division or modulo by zero
背后的原因是什么
整数不能被零除,但浮点数可以吗?
在 python 中,为什么它不是 NaN 或 Infinity,而是所有错误?