ladybird/Userland/Libraries/LibJS
Shannon Booth f589bedb0d LibJS: Improve JS::modulo precision for large floating values
JS::modulo was yielding a result of '0' for the input:
```
modulo(1., 18446744073709551616.)
```

Instead of the expected '1'.

As far as I can tell the reason for this is that the repeated calls to
fmod is losing precision in the calculation, leading to the wrong
result. Fix this by only calling fmod once, and preserving the negative
value behaviour by an 'if' check.

Without this, the LibWeb text test:
`/Streams/ReadableByteStream-enqueue-respond.html`

Would hang forever after using this function in the IDL conversion of a
u64 in ConvertToInt.

This should also be more efficient :^)
2024-01-02 10:01:26 +01:00
..
Bytecode LibJS: Use existing AOs to validate bytecode/JIT TypedArray indices 2023-12-26 11:16:10 +01:00
Contrib/Test262 Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
Heap LibJS: Show class in SerenityOS mmap name for type-specific allocators 2023-12-31 15:35:56 +01:00
JIT Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
Runtime LibJS: Improve JS::modulo precision for large floating values 2024-01-02 10:01:26 +01:00
Tests LibJS: Implement missing steps from the ArrayBuffer transfer proposal 2023-12-29 09:25:41 +01:00
AST.cpp Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
AST.h Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
CMakeLists.txt LibJS: Skip test262 tests with the CanBlockIsFalse flag 2023-11-30 09:51:46 -05:00
Console.cpp LibJS: Make ExecutionContext::function_name a GCPtr<PrimitiveString> 2023-11-29 09:48:18 +01:00
Console.h LibJS: Begin implementing console.dir 2023-06-22 06:46:27 +02:00
CyclicModule.cpp Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
CyclicModule.h LibJS: Update import referrer's [[LoadedModules]] in place 2023-12-03 20:46:55 +01:00
Forward.h LibJS: Stop converting between Object <-> IteratorRecord all the time 2023-12-07 14:06:34 +01:00
Lexer.cpp Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
Lexer.h Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
MarkupGenerator.cpp LibJS: Use OrderedHashMap for the Shape property table 2023-09-17 21:00:11 +02:00
MarkupGenerator.h LibJS: Fix redundancy-detection when printing raw values 2023-06-15 08:09:16 +02:00
Module.cpp Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
Module.h Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
ModuleLoading.h LibJS+LibWeb: Another round of bringing module loading closer to spec 2023-12-03 20:46:55 +01:00
Parser.cpp Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
Parser.h Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
ParserError.cpp Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
ParserError.h Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
Position.h LibJS: Make line-and-column resolution fast for large minified JS 2023-09-12 17:21:42 +02:00
Print.cpp LibJS+LibWeb: Implement resizable ArrayBuffer support for TypedArray 2023-12-26 11:16:10 +01:00
Print.h Everywhere: Remove the AK:: qualifier from Stream usages 2023-02-13 00:50:07 +00:00
SafeFunction.h LibJS: Add GC graph dumper 2023-08-17 18:27:02 +02:00
Script.cpp LibJS: Segregate GC-allocated objects by type 2023-11-19 12:10:31 +01:00
Script.h Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
SourceCode.cpp LibJS: Make line-and-column resolution fast for large minified JS 2023-09-12 17:21:42 +02:00
SourceCode.h LibJS: Make line-and-column resolution fast for large minified JS 2023-09-12 17:21:42 +02:00
SourceRange.h Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30
SourceTextModule.cpp LibJS: Only consider VM-accessible execution contexts as strong roots 2023-12-13 11:19:13 +01:00
SourceTextModule.h LibJS: Always allocate ExecutionContext objects on the malloc heap 2023-11-29 09:48:18 +01:00
SyntaxHighlighter.cpp LibSyntax+Userland: Make LibSyntax not depend on LibGUI 2023-08-29 07:57:39 -04:00
SyntaxHighlighter.h LibSyntax: Teach each highlighter about it's comment syntax 2022-11-27 18:28:43 -07:00
SyntheticModule.cpp LibJS: Support LoadRequestedModule AO on SyntheticModule records 2023-12-03 20:46:55 +01:00
SyntheticModule.h LibJS: Support LoadRequestedModule AO on SyntheticModule records 2023-12-03 20:46:55 +01:00
Token.cpp Everywhere: Use to_number<T> instead of to_{int,uint,float,double} 2023-12-23 20:41:07 +01:00
Token.h Everywhere: Rename {Deprecated => Byte}String 2023-12-17 18:25:10 +03:30