How to floor without format
Closed this issue · 2 comments
longhoangwkm commented
Hi, I checked solution from #69
y = new BigNumber('1234567.898765');
y.toFormat(2, BigNumber.ROUND_DOWN); // '1,234,567.89'
y.toFormat(2, 1); // '1,234,567.89'
But that is not solution what I looking for. I wanna floor without comma. Is there any way to do
Expected result: 1234567.89
MikeMcl commented
Please don't link old issues. Issues are not the place to learn from.
There is a decimalPlaces method to round a BigNumber to a specified number of decimal places.
y = new BigNumber('1234567.898765');
y = y.decimalPlaces(2, BigNumber.ROUND_FLOOR);
y.toString(); // '1234567.89'
Please ask any further usage questions on a website like Stack Overflow.
longhoangwkm commented
Thanks