summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2017-01-06 21:40:53 (EST)
committer P. J. McDermott <pj@pehjota.net>2017-01-06 21:40:53 (EST)
commit3b2b2c8faed66b2397c6503cac07ca8cb8113ef5 (patch)
treefef7cc2c51d0a265a094e0b827f6889f82c06e65
parentd33281db4a6e1947863a61e9b15a0a87462197c9 (diff)
downloaddecmath.js-3b2b2c8faed66b2397c6503cac07ca8cb8113ef5.zip
decmath.js-3b2b2c8faed66b2397c6503cac07ca8cb8113ef5.tar.gz
decmath.js-3b2b2c8faed66b2397c6503cac07ca8cb8113ef5.tar.bz2
dadd(): Remove debugging output
-rw-r--r--lib/decmath.js16
1 files changed, 0 insertions, 16 deletions
diff --git a/lib/decmath.js b/lib/decmath.js
index fbb4e9e..45f7cb4 100644
--- a/lib/decmath.js
+++ b/lib/decmath.js
@@ -33,39 +33,23 @@
function dadd(a, b)
{
- //console.log(a + " + " + b);
a = a.toString().split(".", 2);
b = b.toString().split(".", 2);
if (typeof a[1] == "undefined") a[1] = "";
if (typeof b[1] == "undefined") b[1] = "";
- //console.log("ai: " + a[0] + ", af: " + a[1]);
- //console.log("bi: " + b[0] + ", bf: " + b[1]);
var ce;
if (a[1].length == b[1].length) {
ce = a[1].length;
} else if (a[1].length < b[1].length) {
- //console.log("padding af with " + (b[1].length - a[1].length) +
- // " zeroes");
a[1] += Array(b[1].length - a[1].length + 1).join("0");
ce = b[1].length;
} else {
- //console.log("padding bf with " + (a[1].length - b[1].length) +
- // " zeroes");
b[1] += Array(a[1].length - b[1].length + 1).join("0");
ce = a[1].length;
}
- //console.log("after padding:");
- //console.log("ai: " + a[0] + ", af: " + a[1]);
- //console.log("bi: " + b[0] + ", bf: " + b[1]);
var as = a[0] + a[1];
var bs = b[0] + b[1];
- //console.log("as: " + as + ", ae: " + a[1].length);
- //console.log("bs: " + bs + ", be: " + b[1].length);
var cs = (parseInt(as, 10) + parseInt(bs, 10)).toString();
- //console.log("cs: " + cs + ", ce: " + ce);
- //console.log(ce);
- //console.log(cs.length);
- //console.log(ce - cs.length + 1);
var pad = ce - cs.length;
if (pad > 0) cs = (Array(pad + 1).join("0") + cs).toString();
return cs.substr(0, cs.length - ce) + "." + cs.substr(cs.length - ce);