-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request
Description
Currently (latest break_eternity.js
version as of 2023-01-07), attempting to convert a BigInt value to Decimal will return 0. Furthermore, a string that represents a number (generated by BigInt.toString()
) will also return 0 if the number the string represents is at least 21024.
Console output with test cases:
new Decimal(String(2n**1022n)).toString() // 1
'4.494232837155819e307'
new Decimal(String(2n**1032n)).toString() // 2
'0'
new Decimal(1234n).toString() // 3
'0'
new Decimal(2n**1234n).toString() // 4
'0'
- Correct
- Incorrect; should be 21032 or about 4.602094e310
- Incorrect; should be 1234
- Incorrect; should be 21234 or about 2.958112e371
Discovered whilst writing migration code for an incremental game to convert various save data from BigInt values to their proper Decimals.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request