Well let's look at wikipedia's list of things that cause IEEE NaN, since they already split out Infinity.
0/0, ∞/∞, ∞%n, n%0, ∞-∞, results with imaginary components
The first five have no meaningful approximation or way to interact with anything. And there's no good way to pretend a single float is a complex number.
So those results get the "this doesn't exist" treatment. Coder's choice if NaN triggers errors or not.
Would you try to define any more behavior for any of those NaNs?
Comments
Well let's look at wikipedia's list of things that cause IEEE NaN, since they already split out Infinity.
0/0, ∞/∞, ∞%n, n%0, ∞-∞, results with imaginary components
The first five have no meaningful approximation or way to interact with anything. And there's no good way to pretend a single float is a complex number.
So those results get the "this doesn't exist" treatment. Coder's choice if NaN triggers errors or not.
Would you try to define any more behavior for any of those NaNs?
Only if you wanted to treat them as more severe types of NaN, Aka ∞-∞ - ∞ can evaluate to ∞-∞, but ∞-∞ / 0 = 0/0.
Though really that choice is just about what kind of errors you’re showing users.