-
Take the following code snippet: const foo = FixedNumber.fromValue(BigNumber.from("10"), 1);
console.log(foo.toString()); I was expecting this to log x "1", but it logs "1.0". Is there an option to remove the superfluous zeros after the dot, if not when initializing the FixedNumber, at least when printing it out with I know that I could use regular expressions for this, but I would prefer to use a "native" solution, if there exists one. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
No, the string format is intentionally stable so that it is easier to parse using |
Beta Was this translation helpful? Give feedback.
-
Side question: is there any case when I ran it on this number:
With the decimals set to 18, and I still got |
Beta Was this translation helpful? Give feedback.
No, the string format is intentionally stable so that it is easier to parse using
.split(".")
, which will always contain exactly two components. The only exception to this is if the number of decimals is0
, in which case there will never be a decimal point in the output.