-
Notifications
You must be signed in to change notification settings - Fork 452
Arithmetic operators allow manifesting NaN #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think you need #2 to get the behavior you're looking for? |
The spec mentioned "floating-point arithmetic", so I'd already assumed IEEE doubles. It's more an issue of consistently handling special float values and avoiding invalid JSON output (eg, "1 / 0" sensibly produces an error rather than manifesting "inf"). Switching to arbitrary-precision rationals would certainly do the trick. Though std.sin and friends may get a little trickier to implement :) |
On a related note:
|
Ah yes, I had forgotten that JSON does not allow these values. So the question is, should they generate errors whenever they appear as immediate values (fail fast) or should there only be an error if they reach manifestation time. It seems to me that the latter behavior will be quite annoying. The NaN / inf will propagate through values and it will be hard to know where it originally came from. I can't think of any compelling use cases for allowing NaN and inf in a config language. |
+1 for failing fast. NaN is an atrocity, and the best argument I can think of for allowing an intermediate inf is that it's occasionally convenient as an initial value in algorithms like computing a minimum. Not very compelling. |
The text was updated successfully, but these errors were encountered: