From 71cd92d2252f13aa313ed5377c4f2b0eb0c424b4 Mon Sep 17 00:00:00 2001 From: "Ryan X. Charles" Date: Wed, 18 Dec 2013 20:08:52 -0500 Subject: [PATCH] fix truncation error in parseValue --- test/util-util.js | 5 ++++- util/util.js | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/test/util-util.js b/test/util-util.js index aba0be8..fb4650a 100644 --- a/test/util-util.js +++ b/test/util-util.js @@ -16,7 +16,10 @@ describe('util/util', function(){ [ "1.0", "100000000" ], [ "0.1", "10000000" ], [ ".1", "10000000" ], - [ "0.0005", "50000" ] + [ "0.0005", "50000" ], + [ ".000000001", "0" ], + [ ".000000009", "0" ], + [ ".00000000000000001", "0" ] ]; dataValues.forEach(function(datum) { test_value(datum); }); }); diff --git a/util/util.js b/util/util.js index 9c54ea2..145568d 100644 --- a/util/util.js +++ b/util/util.js @@ -113,6 +113,7 @@ var reWholeVal = /^\s*(\d+)/; function padFrac(frac) { + frac=frac.substr(0,8); //truncate to 8 decimal places while (frac.length < 8) frac = frac + '0'; return frac;