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
commit 1e0facb7ee
Notes: sideshowbarker 2024-07-19 18:29:40 +09:00
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();