mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:27:35 +00:00
LibJS: Use u64 instead of u32 in NumberPrototype::to_string
Update to #7033 Partial fix for #7034 (just ups the range to about 2 ** 54 before losing precision)
This commit is contained in:
parent
2ff03ecfa8
commit
c5c9494f48
2 changed files with 3 additions and 2 deletions
|
@ -80,7 +80,7 @@ JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_string)
|
|||
if (negative)
|
||||
number *= -1;
|
||||
|
||||
u32 int_part = floor(number);
|
||||
u64 int_part = floor(number);
|
||||
double decimal_part = number - int_part;
|
||||
|
||||
Vector<char> backwards_characters;
|
||||
|
@ -111,7 +111,7 @@ JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_string)
|
|||
|
||||
for (u8 i = 0; i < precision; ++i) {
|
||||
decimal_part *= radix;
|
||||
u32 integral = floor(decimal_part);
|
||||
u64 integral = floor(decimal_part);
|
||||
characters.append(digits[integral]);
|
||||
decimal_part -= integral;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue