mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:27:35 +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:
parent
602190f66f
commit
1e0facb7ee
3 changed files with 9 additions and 30 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue