Skip to content
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

NaN assertion is inconsistent with the standard and IEEE754 #682

Closed
zerkms opened this issue Apr 20, 2016 · 2 comments
Closed

NaN assertion is inconsistent with the standard and IEEE754 #682

zerkms opened this issue Apr 20, 2016 · 2 comments

Comments

@zerkms
Copy link

zerkms commented Apr 20, 2016

The following test assertion (from https://github.com/chaijs/chai/blob/master/test%2Fassert.js#L332)

  it('isNaN', function() {
    assert.isNaN('hello');

    err(function (){
      assert.isNaN(4);
    }, "expected 4 to be NaN");
  });

must not pass, since the "hello" is definitely not a NaN value

Which is pretty much different from "it's not a number", but a special value defined by the standard and the IEEE754.

@zerkms
Copy link
Author

zerkms commented Apr 20, 2016

Ok, seems like it's subjective, since the isNaN and Number.isNaN behave differently.

But at least the documentation should be changed.

Currently it states:

Asserts that the target is NaN.

technically it could state

Asserts that the target is not a number.

but then it also would be wrong since isNaN(false) // false.

So, any thoughts? ;-)

@zerkms zerkms closed this as completed Apr 20, 2016
@zerkms zerkms reopened this Apr 20, 2016
@keithamus
Copy link
Member

Hey @zerkms thanks for the issue.

This is actually a duplicate of #681, which we found out is a dupe of #498 - and will be fixed in our 4.0.0 release, which is coming soon. I'll close this one, but thanks for filing this issue and please don't hesitate to open any new ones if you find anything new!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants