I've got a problem with rounding in JavaScript. I'm using a function for rounding:
function roundup(rnum, rlength){
var newnumber = Math.round(rnum * Math.pow(10, rlength)) / Math.pow(10, rlength);
return newnumber;
}
var amount = roundup(2253.825, 3);
Strange thing is, when I round up the number 2253.825
, the result is 2253.82
which has to be 2253.83
. When I round up the number 5592.825
the result is 5592.83
, which is correct.
Any idea how to fix this?