3 ms·
Dividing by 0 or -0 is a valid floating-point operation because there's an infinity in the number system, and JS uses double precision floating point for all nu
by pclmulqdq 4y ago
Dividing by 0 or -0 is a valid floating-point operation because there's an infinity in the number system, and JS uses double precision floating point for all numbers. Python has an integer type and a double type, and division by 0 is disallowed for integers, but okay for doubles.
- MichaelMoser123 4y agoyour explanation makes sense, however python doesn't allow division of floating point number by 0 either: >>> type(1.0) <class 'float'> >>> 1.0/0 Traceback (most recent call last): File "<stdin>", line 1, in <module> ZeroDivisionError: float division by zero However numpy lets you do it - it is only a warning >>> import numpy as np >>> >>> np.divide(1.0,0) __main__:1: RuntimeWarning: divide by zero encountered in true_divide inf
- pclmulqdq 4y agoWow, Python really does hold your hand. >>> 1/0.0 Traceback (most recent call last): File "<stdin>", line 1, in <module> ZeroDivisionError: float division by zero >>> 1.0/0.0 Traceback (most recent call last): File "<stdin>", line 1, in <module> ZeroDivisionError: float division by zero