- divide : function(n){
- if((n = new Roo.util.Math(n, this.precision, this.roundType)) == "0")
- throw new Error("Division by 0");
- else if(this == "0")
- return new Roo.util.Math(0, this.precision, this.roundType);
- var o = new Roo.util.Math(this), a = o._d, b = n._d, la = a.length - o._f,
- lb = b.length - n._f, r = new Roo.util.Math(0, this.precision, this.roundType), i = 0, j, s, l, f = 1, c = 0, e = 0;
- r._s = o._s != n._s, r.precision = Math.max(o.precision, n.precision),
- r._f = +r._d.pop(), la != lb && o._zeroes(la > lb ? b : a, Math.abs(la - lb));
- n._f = b.length, b = n, b._s = false, b = b.round();
- for(n = new Roo.util.Math(0, this.precision, this.roundType); a[0] == "0"; a.shift());
- out:
- do{
- for(l = c = 0, n == "0" && (n._d = [], n._f = 0); i < a.length && n.compare(b) == -1; ++i){
- (l = i + 1 == a.length, (!f && ++c > 1 || (e = l && n == "0" && a[i] == "0")))
- && (r._f == r._d.length && ++r._f, r._d.push(0));
- (a[i] == "0" && n == "0") || (n._d.push(a[i]), ++n._f);
- if(e)
- break out;
- if((l && n.compare(b) == -1 && (r._f == r._d.length && ++r._f, 1)) || (l = 0))
- while(r._d.push(0), n._d.push(0), ++n._f, n.compare(b) == -1);
- }
- if(f = 0, n.compare(b) == -1 && !(l = 0))
- while(l ? r._d.push(0) : l = 1, n._d.push(0), ++n._f, n.compare(b) == -1);
- for(s = new Roo.util.Math(0, this.precision, this.roundType), j = 0; n.compare(y = s.add(b)) + 1 && ++j; s.set(y));
- n.set(n.subtract(s)), !l && r._f == r._d.length && ++r._f, r._d.push(j);
- }
- while((i < a.length || n != "0") && (r._d.length - r._f) <= r.precision);
- return r.round();
- },
+ divide : function(n){
+ if((n = new Roo.util.Math(n, this.precision, this.roundType)) == "0")
+ throw new Error("Division by 0");
+ else if(this == "0")
+ return new Roo.util.Math(0, this.precision, this.roundType);
+ var o = new Roo.util.Math(this), a = o._d, b = n._d, la = a.length - o._f,
+ lb = b.length - n._f, r = new Roo.util.Math(0, this.precision, this.roundType), i = 0, j, s, l, f = 1, c = 0, e = 0;
+ r._s = o._s != n._s, r.precision = Math.max(o.precision, n.precision),
+ r._f = +r._d.pop(), la != lb && o._zeroes(la > lb ? b : a, Math.abs(la - lb));
+ n._f = b.length, b = n, b._s = false, b = b.round();
+ for(n = new Roo.util.Math(0, this.precision, this.roundType); a[0] == "0"; a.shift());
+ out:
+ do{
+ for(l = c = 0, n == "0" && (n._d = [], n._f = 0); i < a.length && n.compare(b) == -1; ++i){
+ (l = i + 1 == a.length, (!f && ++c > 1 || (e = l && n == "0" && a[i] == "0")))
+ && (r._f == r._d.length && ++r._f, r._d.push(0));
+ (a[i] == "0" && n == "0") || (n._d.push(a[i]), ++n._f);
+ if(e)
+ break out;
+ if((l && n.compare(b) == -1 && (r._f == r._d.length && ++r._f, 1)) || (l = 0))
+ while(r._d.push(0), n._d.push(0), ++n._f, n.compare(b) == -1);
+ }
+ if(f = 0, n.compare(b) == -1 && !(l = 0))
+ while(l ? r._d.push(0) : l = 1, n._d.push(0), ++n._f, n.compare(b) == -1);
+ for(s = new Roo.util.Math(0, this.precision, this.roundType), j = 0; n.compare(y = s.add(b)) + 1 && ++j; s.set(y));
+ n.set(n.subtract(s)), !l && r._f == r._d.length && ++r._f, r._d.push(j);
+ }
+ while((i < a.length || n != "0") && (r._d.length - r._f) <= r.precision);
+ return r.round();
+ },