-
Does anyone have any tips/tricks for using ethers' existing BigNumber functionality for decimal division? Something like
|
Beta Was this translation helpful? Give feedback.
Answered by
ricmoo
Dec 17, 2020
Replies: 1 comment 1 reply
-
You can use the FixedNumber class for this: a = FixedNumber.from("1.5");
b = FixedNumber.from("0.3");
b.divUnsafe(a).toString(); The BigNumber class is specifically for integers, while the fixed point math allows you to specify a format (by default Does that help? |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
jotto
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use the FixedNumber class for this:
The BigNumber class is specifically for integers, while the fixed point math allows you to specify a format (by default
"fixed128x18"
, which should suffice for most purposes).Does that help?