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
The toWei() function will return incorrect results when passing numbers smaller than 1e-6 to it.
For example toWei(1e-7, 'gwei').toString() will return 2377000000000 instead of 100.
The issue starts here and then cascades downward. The problem is that you are using the String constructor to convert number to a string. However, it will produce some small numbers in exponential notation instead of the fixed notation that you are expecting.
Issue Type
Description
The
toWei()
function will return incorrect results when passing numbers smaller than1e-6
to it.For example
toWei(1e-7, 'gwei').toString()
will return2377000000000
instead of100
.The issue starts here and then cascades downward. The problem is that you are using the
String
constructor to convert number to a string. However, it will produce some small numbers in exponential notation instead of the fixed notation that you are expecting.Steps to reproduce
Check the PR #7.
Versions
Doesn't matter.
The text was updated successfully, but these errors were encountered: