serenity icon indicating copy to clipboard operation
serenity copied to clipboard

LibJS: toString() on numbers greater than or equal to 2 ** 64 returns "0."

Open Lubrsi opened this issue 3 years ago • 4 comments

Example:

(2 ** 64).toString()

Expected: "18446744073709552000" Actual: "0."

Lubrsi avatar May 11 '21 16:05 Lubrsi

So a fix would be to check for a possible overflows and falback to floats/doubles in these cases

Hendiadyoin1 avatar May 13 '21 23:05 Hendiadyoin1

Looks like can be closed now.

debdutdeb avatar Oct 23 '22 08:10 debdutdeb

We still get a wrong result as far as I can tell, 18446744073709552046 instead of 18446744073709552000

IdanHo avatar Oct 23 '22 18:10 IdanHo

Looks like can be closed now.

If you're talking about #15377 being merged indeed this only fixed parsing doubles not to_string the opposite direction as Idan shows

davidot avatar Oct 23 '22 21:10 davidot

This serializes correctly today.

awesomekling avatar Oct 24 '23 13:10 awesomekling