On 3/1/19 1:04 PM, David G. Johnston wrote:
> 1/0 is an illegal operation. We could return NaN for it but the choice of
> throwing an error is just as correct. Returning infinity is strictly
> incorrect.
That differs from my understanding of how the operations are specified
in IEEE 754 (as summarized in, e.g., [1]).
Andrew posted the relevant part of the SQL spec that requires the
operation to raise 22012.
That's a requirement specific to SQL (which is, of course, what matters
here.)
But if someone wanted to write a user-defined division function or
operator that would return Inf for (anything > 0) / 0 and for
(anything < 0) / -0, and -Inf for (anything < 0) / 0 and for
(anything > 0) / -0, and NaN for (either zero) / (either zero), I think
that function or operator would be fully in keeping with IEEE 754.
-Chap
[1] https://steve.hollasch.net/cgindex/coding/ieeefloat.html#operations