diff options
author | Anonymous <anon@mous.org> | 2022-02-16 02:14:57 -0800 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-02-16 11:18:41 +0000 |
commit | 1e0facb7ee71a8611052b4f87bd36a435d35050a (patch) | |
tree | 5d79ed00f44e5d4927a35c373dcc0514ba29bc95 /Userland/Libraries/LibJS/Tests/test-common.js | |
parent | 602190f66f7d74bba019b42870d1fc93e5a26a51 (diff) | |
download | serenity-1e0facb7ee71a8611052b4f87bd36a435d35050a.zip |
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.
Diffstat (limited to 'Userland/Libraries/LibJS/Tests/test-common.js')
-rw-r--r-- | Userland/Libraries/LibJS/Tests/test-common.js | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Tests/test-common.js b/Userland/Libraries/LibJS/Tests/test-common.js index 1f9e3af979..b02c9cb287 100644 --- a/Userland/Libraries/LibJS/Tests/test-common.js +++ b/Userland/Libraries/LibJS/Tests/test-common.js @@ -53,6 +53,9 @@ class ExpectationError extends Error { const valueToString = value => { try { + if (value === 0 && 1 / value < 0) { + return "-0"; + } return String(value); } catch { // e.g for objects without a prototype, the above throws. |