Skip to content

Commit

Permalink
Fixes #16411. IE only needed a workaround for rounding [0.5,0.95) ins…
Browse files Browse the repository at this point in the history
…tead [0.5,1.0). Added automated tests. !strict
  • Loading branch information
Douglas Hays committed Nov 30, 2012
1 parent 57799c7 commit a017243
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion math/round.js
Expand Up @@ -54,8 +54,13 @@ define(["dojo", "dojox"], function(dojo, dojox) {
var round = dojox.math.round;
dojox.math.round = function(v, p, m){
var d = Math.pow(10, -p || 0), a = Math.abs(v);
if(!v || a >= d || a * Math.pow(10, p + 1) < 5){
if(!v || a >= d){
d = 0;
}else{
a /= d;
if(a < 0.5 || a >= 0.95){
d = 0;
}
}
return round(v, p, m) + (v > 0 ? d : -d);
}
Expand Down

0 comments on commit a017243

Please sign in to comment.