On 9/14/20 12:34 PM, Stephen J. Turnbull wrote:
That's fine, but Python doesn't give you that. In floats, 0.0 is not true 0, it's the set of all underflow results plus true 0. So by your argument, in float arithmetic, we should not have ZeroDivisionErrors. But we do raise them.
Actually, with IEEE, 0.0 should be all numbers, when rounded to the nearest representation give the value 0.
When we get to very small numbers, the 'sub-normals', we get numbers that are really some integral value times 2 to some negative power (I think it is something like 2 to the -1022 for the standard 64 bit floats). This says that as we approach 0, we have sequence of evenly spaced representable values, 3*2**-1022, 2*2**-1022, 1*2**-1022, 0*2**-1022
Thus the concept of "Zero" makes sense as the nearest representable value.
Now, as been mentioned, "Infinity", doesn't match this concept, unless you do something like define it as it represents a value just above the highest represntable value, but that doesn't match the name.