You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When sending a payment transaction 1,000,000,000.00000001 coins from a cold wallet address, the confirmation dialog loses the fractional 0.00000001 in the payment amount.
The text was updated successfully, but these errors were encountered:
Sergiojiu747 and I found out the reason for the display problem.
The following is the original code:
amount: Number((this.coldAmount * VEE_PRECISION).toFixed(0)) where VEE_PRECISION=1e8
this is used to solve the problem of precision in arithmetic operation in JavaScript (By converting decimals to integers ,then calculating)
However, the maximum number of digits that javascript supports is 16bits.So if the integer >1e16 (or 9007199254740992),the result will be wrong.
Test results:
1.Input:10000000.00000001 位数:16 (Input1e8).toFixed(0): 1000000000000001 and transfered number is: 10000000.00000001
2.Input:1000000000.00000001 位数:18 (Input1e8).toFixed(0): 100000000000000000 and transfered number is: 1000000000
So, the problem is caused by JavaScript itself.
One suggestion is that we can give a warning message if the amount is bigger than 16 digits , and suggest divide the transaction into small ones . Another suggestion is limiting the maximum transaction amount in the first place.
When sending a payment transaction 1,000,000,000.00000001 coins from a cold wallet address, the confirmation dialog loses the fractional 0.00000001 in the payment amount.
The text was updated successfully, but these errors were encountered: