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

fix comparison with -0 in Math.js #11183

Merged
merged 1 commit into from
Apr 16, 2017
Merged

Conversation

evanw
Copy link
Contributor

@evanw evanw commented Apr 16, 2017

I'm writing a static analyzer for JavaScript and I noticed an incorrect equality check in the unit test for the Math.sign polyfill. Checking x === -0 doesn't work as intended because 0 === -0. You need to additionally check that 1 / x < 0 since 1 / -0 === -Infinity.

@mrdoob
Copy link
Owner

mrdoob commented Apr 16, 2017

Nice solution 👌

@mrdoob mrdoob merged commit aecc4e5 into mrdoob:dev Apr 16, 2017
@mrdoob
Copy link
Owner

mrdoob commented Apr 16, 2017

Thanks!

@evanw evanw deleted the math-sign-test-fix branch April 16, 2017 05:24
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

Successfully merging this pull request may close these issues.

2 participants