fix truncation error in parseValue

This commit is contained in:
Ryan X. Charles 2013-12-18 20:08:52 -05:00
parent 7d0a3da3e4
commit 71cd92d225
2 changed files with 5 additions and 1 deletions

View File

@ -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); });
});

View File

@ -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;