Closed FrancescBagur closed 2 years ago
That would only happen if the precision has been set to 2.
Decimal.precision = 2;
new Decimal('10.25').add('2.3').toNumber();
// 13
At the default precision the answer is of course as expected:
Decimal.precision = 20;
new Decimal('10.25').add('2.3').toNumber();
// 12.55
Anything else?
Thank you very much. This was the problem ;)
I'm using the add function as in the next example:
new Decimal('10.25').add(new Decimal('2.3')).toNumber()
and it returns "13". There are no decimals in the result.