-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
fix handling of NaN in Number$prototype$lte to guarantee totality #88
Conversation
Why do we consider > typeof NaN
'number'
> typeof null
'object'
> type(NaN)
'Number'
> type(null)
'Null' |
Ah I found the answer: > Object.prototype.toString.call(NaN)
'[object Number]'
> Object.prototype.toString.call(null)
'[object Null]' |
I'm looking for a reason to exclude |
I think this library should remain unopinionated, so should support all |
We might end up being forced to form an opinion either way, because of |
I'll give people a day or two to comment on this pull request before I merge it. |
Well, now that it's committed, I finally manage to look at it. But it certainly seems fine to me. Somehow you need to deal with this case, and the native behavior is incoherent. The decision is arbitrary, but at least it's coherent. |
Currently,
Z.lte(NaN, 0)
andZ.lte(0, NaN)
both evaluatefalse
, violating the totality law.I arbitrarily decided to make
NaN
the “smallest”Number
value./cc @CrossEye