mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:07:44 +00:00
LibJS: Fix old object numeric key test now that toString() is correct
This commit is contained in:
parent
d3524f47a0
commit
f603128e55
2 changed files with 4 additions and 7 deletions
|
@ -134,15 +134,13 @@ static String double_to_string(double d)
|
|||
|
||||
auto number_string = number_string_builder.to_string();
|
||||
|
||||
// HACK: (sunverwerth) I'm not sure how the ECMAScript spec deals with numbers that
|
||||
// can not be exactly represented in IEE754 so I'm cutting off after the 15th fractional digit.
|
||||
// Otherwise 3.14.toString() would come out as "3.140000000000000124344978758017532527446746826171875"
|
||||
// Chrome and Firefox output the expected "3.14" here
|
||||
// FIXME: Remove this hack.
|
||||
// FIXME: Instead find the shortest round-trippable representation.
|
||||
// Remove decimals after the 15th position
|
||||
if (end_index > intpart_end + 15) {
|
||||
exponent += end_index - intpart_end - 15;
|
||||
end_index = intpart_end + 15;
|
||||
}
|
||||
// HACK end
|
||||
|
||||
// remove leading zeroes
|
||||
while (start_index < end_index && number_string[start_index] == '0') {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue