1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:48:12 +00:00

LibJS: Implement the Number::remainder AO using fmod

The ECMA verbiage for modulus is the mathematical definition implemented
by fmod, so let's just use that rather than trying to reimplement all
the edge cases.
This commit is contained in:
Anonymous 2022-02-16 02:14:57 -08:00 committed by Linus Groh
parent 602190f66f
commit 1e0facb7ee
3 changed files with 9 additions and 30 deletions

View file

@ -23,6 +23,7 @@ test("basic functionality", () => {
expect(1 % -0).toBeNaN();
expect(0 % 5).toBe(0);
expect(-0 % 5).toBe(-0);
expect((-1) % -1).toBe(-0);
// test262 examples
expect(1 % null).toBeNaN();