Currency rounding inconsistencies in Dojo.currency -
im working dojo.currency format. there seems inconstancies on how rounds, im trying find if im doing wrong:
dojo.currency.format("66.315",{currency:"usd"}) "$66.31" dojo.currency.format("669.315",{currency:"usd"}) "$669.32"
in above example both prices rounded 32 cents, reason end 2 different amounts.
looks dojo.currency using dojo.number.round under covers, , dojo.number.round uses javascript tofixed. known have floating point problem.
using math.round(number*math.pow(10,places))/math.pow(10,places) instead
Comments
Post a Comment