-
Notifications
You must be signed in to change notification settings - Fork 859
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 Math.atanh
#1438
Fix Math.atanh
#1438
Changes from 1 commit
decb266
8d62fb7
2549003
ead8b06
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,4 +54,78 @@ assertEquals(Math.imul(-2, -2), 4); | |
assertEquals(Math.imul(0xffffffff, 5), -5); | ||
assertEquals(Math.imul(0xfffffffe, 5), -10); | ||
|
||
assertEqualsDelta(Math.atanh(1/2), 0.549306144334059, 0.0000000000001); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because the 262 tests suite seems to have no tests for this maybe you can add some more samples There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
assertEquals(Math.atanh(0), 0); | ||
assertEquals(Math.atanh(-0), -0); | ||
assertEquals(Math.atanh(1), Infinity); | ||
assertEquals(Math.atanh(-1), -Infinity); | ||
assertEquals(Math.atanh(Infinity), NaN); | ||
assertEquals(Math.atanh(-Infinity), NaN); | ||
assertEquals(Math.atanh(NaN), NaN); | ||
assertEquals(Math.atanh('foo'), NaN); | ||
assertEquals(Math.atanh(), NaN); | ||
|
||
assertEqualsDelta(Math.asinh(1), 0.8813735870195429, 0.0000000000001); | ||
assertEqualsDelta(Math.asinh(-1/2), -0.48121182505960336, 0.0000000000001); | ||
assertEquals(Math.asinh(0), 0); | ||
assertEquals(Math.asinh(-0), -0); | ||
assertEquals(Math.asinh(Infinity), Infinity); | ||
assertEquals(Math.asinh(-Infinity), -Infinity); | ||
assertEquals(Math.asinh(NaN), NaN); | ||
assertEquals(Math.asinh('foo'), NaN); | ||
assertEquals(Math.asinh(), NaN); | ||
|
||
assertEquals(Math.acosh(1), 0); | ||
assertEquals(Math.acosh(-1), NaN); | ||
assertEqualsDelta(Math.acosh(2), 1.3169578969248166, 0.0000000000001); | ||
assertEquals(Math.acosh(0), NaN); | ||
assertEquals(Math.acosh(-0), NaN); | ||
assertEquals(Math.acosh(Infinity), Infinity); | ||
assertEquals(Math.acosh(-Infinity), NaN); | ||
assertEquals(Math.acosh(NaN), NaN); | ||
assertEquals(Math.acosh('foo'), NaN); | ||
assertEquals(Math.acosh(), NaN); | ||
|
||
assertEquals(Math.log2(1), 0); | ||
assertEquals(Math.log2(2), 1); | ||
assertEqualsDelta(Math.log2(3), 1.584962500721156, 0.0000000000001); | ||
assertEquals(Math.log2(0), -Infinity); | ||
assertEquals(Math.log2(-0), -Infinity); | ||
assertEquals(Math.log2(-2), NaN); | ||
assertEquals(Math.log2(NaN), NaN); | ||
assertEquals(Math.log2('foo'), NaN); | ||
assertEquals(Math.log2(), NaN); | ||
|
||
assertEquals(Math.sign(1), 1); | ||
assertEquals(Math.sign(2), 1); | ||
assertEquals(Math.sign(-3), -1); | ||
assertEquals(Math.sign(0), 0); | ||
assertEquals(Math.sign(-0), -0); | ||
assertEquals(Math.sign(Infinity), 1); | ||
assertEquals(Math.sign(-Infinity), -1); | ||
assertEquals(Math.sign(NaN), NaN); | ||
assertEquals(Math.sign('foo'), NaN); | ||
assertEquals(Math.sign(), NaN); | ||
|
||
assertEquals(Math.clz32(0), 32); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a separate PR #1430 for clz32, maybe we have to merge the two different approaches of tests for the functions There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've removed all the cases from this file - it seems the other PR will add complete coverage |
||
assertEquals(Math.clz32(1), 31); | ||
assertEquals(Math.clz32(2), 30); | ||
assertEquals(Math.clz32(-0), 32); | ||
assertEquals(Math.clz32(-2), 0); | ||
assertEquals(Math.clz32(Infinity), 32); | ||
assertEquals(Math.clz32(-Infinity), 32); | ||
assertEquals(Math.clz32(NaN), 32); | ||
assertEquals(Math.clz32(NaN), 32); | ||
assertEquals(Math.clz32('foo'), 32); | ||
assertEquals(Math.clz32(), 32); | ||
|
||
assertEquals(Math.fround(0.5), 0.5); | ||
assertEquals(Math.fround(5.4), 5.400000095367432); | ||
assertEquals(Math.fround(-2.2), -2.200000047683716); | ||
assertEquals(Math.fround(Infinity), Infinity); | ||
assertEquals(Math.fround(-Infinity), -Infinity); | ||
assertEquals(Math.fround(NaN), NaN); | ||
assertEquals(Math.fround('x'), NaN); | ||
assertEquals(Math.fround(), NaN); | ||
|
||
"success"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe pedantic but to be in sync with MDN
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done