openexchangerates / accounting.js

A lightweight JavaScript library for number, money and currency formatting - fully localisable, zero dependencies.
http://openexchangerates.github.io/accounting.js
MIT License
4.95k stars 528 forks source link

Rounding issue [574.425 should be rounded to 574.43] #222

Open MianSaleem opened 3 years ago

MianSaleem commented 3 years ago

First of all, thank you very much for this amazing library.

I want to report the issue with decimal round as following (tested on demo)

574.425 should be rounded to 574.43 same as 574.415 is rounded to 574.42 but 574.425 is being rounded to 574.42. I have tested it on demo here

Thank you

overthemike commented 3 years ago

Looks like it's probably checking the 3rd decimal spot to be anything greater than 5 instead of greater than or equal to 5.

574.4250000000001 will produce 574.43 for example. Not sure if that helps at all but thought I'd throw it out there.

zsxlly commented 1 year ago

Does anyone else solve the problem of this library