mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +00:00
LibJS: Add special cases for Math.cosh and add spec comments
Although this already works in most cases in non-kvm serenity cases the cosh and other math function tend to return incorrect values for Infinity. This makes sure that whatever the underlying cosh function returns Math.cosh conforms to the spec.
This commit is contained in:
parent
379baa984d
commit
b79f03182d
2 changed files with 30 additions and 5 deletions
|
@ -1,7 +1,19 @@
|
|||
test("basic functionality", () => {
|
||||
expect(Math.cosh).toHaveLength(1);
|
||||
describe("basic functionality", () => {
|
||||
test("length", () => {
|
||||
expect(Math.cosh).toHaveLength(1);
|
||||
});
|
||||
|
||||
expect(Math.cosh(0)).toBe(1);
|
||||
expect(Math.cosh(1)).toBeCloseTo(1.5430806348152437);
|
||||
expect(Math.cosh(-1)).toBeCloseTo(1.5430806348152437);
|
||||
test("simple values", () => {
|
||||
expect(Math.cosh(1)).toBeCloseTo(1.5430806348152437);
|
||||
expect(Math.cosh(-1)).toBeCloseTo(1.5430806348152437);
|
||||
});
|
||||
|
||||
test("special values", () => {
|
||||
expect(Math.cosh(0)).toBe(1);
|
||||
expect(Math.cosh(-0.0)).toBe(1);
|
||||
|
||||
expect(Math.cosh(NaN)).toBeNaN();
|
||||
expect(Math.cosh(Infinity)).toBe(Infinity);
|
||||
expect(Math.cosh(-Infinity)).toBe(Infinity);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue