From 3a63a929bf337af9ba9de3b2eb4d2ae0c9d880a0 Mon Sep 17 00:00:00 2001 From: Pastafarianist Date: Thu, 19 Feb 2015 00:24:10 +0300 Subject: [PATCH] Fixed 100 rendered as 1e2 by prettyPrint Due to how prettyPrint was implemented, 100 would always be rendered as 1e2. Fixed that particular error. Still leaves open the issue of rendering 10000 as 1e4, for example. --- src/numeric.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/numeric.js b/src/numeric.js index 537b68f..04b40ba 100644 --- a/src/numeric.js +++ b/src/numeric.js @@ -56,9 +56,9 @@ numeric.prettyPrint = function prettyPrint(x) { if(typeof x === "string") { ret.push('"'+x+'"'); return false; } if(typeof x === "boolean") { ret.push(x.toString()); return false; } if(typeof x === "number") { - var a = fmtnum(x); + var a = parseFloat(x.toString()).toString(); var b = x.toPrecision(numeric.precision); - var c = parseFloat(x.toString()).toString(); + var c = fmtnum(x); var d = [a,b,c,parseFloat(b).toString(),parseFloat(c).toString()]; for(k=1;k