Closed upupming closed 5 years ago
You just need to round the result before you make the comparison. For example, here are three different ways of rounding a BigNumber:
x = b.decimalPlaces(10);
y = b.precision(10);
z = b.integerValue();
x.isEqualTo(1) && y.isEqualTo(1) && z.isEqualTo(1); // true
thanks for your explanation.
Hi, this is a noob question, you can see the result:
Is it possible to make the value of
b
be1
instead of0.99999999999999999999
.I just want to compare two big numbers, but I always got
false
when there is repeating decimal during the calculation.