diff --git a/package.json b/package.json index 2ef5ccf..1dd238d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ssf", - "version": "0.3.0", + "version": "0.3.1", "author": "SheetJS", "description": "pure-JS library to format data using ECMA-376 spreadsheet Format Codes", "keywords": [ "format", "sprintf", "spreadsheet" ], diff --git a/ssf.js b/ssf.js index 76cbe9e..7278a26 100644 --- a/ssf.js +++ b/ssf.js @@ -90,11 +90,20 @@ var general_fmt = function(v) { if(V >= 0.1 && V < 1) o = v.toPrecision(9); else if(V >= 0.01 && V < 0.1) o = v.toPrecision(8); else if(V >= 0.001 && V < 0.01) o = v.toPrecision(7); - else if(V > Math.pow(10,-9) && V < Math.pow(10,10)) { - o = v.toPrecision(10); if(o.length > 11+(v<0?1:0)) o = v.toExponential(5); + else if(V >= 0.0001 && V < 0.001) o = v.toPrecision(6); + else if(V >= Math.pow(10,10) && V < Math.pow(10,11)) o = v.toFixed(10).substr(0,12); + else if(V > Math.pow(10,-9) && V < Math.pow(10,11)) { + o = v.toFixed(12).replace(/(\.[0-9]*[1-9])0*$/,"$1").replace(/\.$/,""); + if(o.length > 11+(v<0?1:0)) o = v.toPrecision(10); + if(o.length > 11+(v<0?1:0)) o = v.toExponential(5); } - else o = v.toPrecision(6); - return o.replace("e","E").replace(/\.0*$/,"").replace(/\.(.*[^0])0*$/,".$1").replace(/(E[+-])([0-9])$/,"$1"+"0"+"$2"); + else { + o = v.toFixed(11).replace(/(\.[0-9]*[1-9])0*$/,"$1") + if(o.length > 11 + (v<0?1:0)) o = v.toPrecision(6); + } + if(v==0.000000001) console.log(v, o); + o = o.replace(/(\.[0-9]*[1-9])0+e/,"$1e").replace(/\.0*e/,"e"); + return o.replace("e","E").replace(/\.0*$/,"").replace(/\.([0-9]*[^0])0*$/,".$1").replace(/(E[+-])([0-9])$/,"$1"+"0"+"$2"); } if(typeof v === 'string') return v; throw "unsupported value in General format: " + v; diff --git a/ssf.md b/ssf.md index 81d470b..f5710d9 100644 --- a/ssf.md +++ b/ssf.md @@ -143,11 +143,20 @@ For numbers, try to display up to 11 digits of the number (the original code if(V >= 0.1 && V < 1) o = v.toPrecision(9); else if(V >= 0.01 && V < 0.1) o = v.toPrecision(8); else if(V >= 0.001 && V < 0.01) o = v.toPrecision(7); - else if(V > Math.pow(10,-9) && V < Math.pow(10,10)) { - o = v.toPrecision(10); if(o.length > 11+(v<0?1:0)) o = v.toExponential(5); + else if(V >= 0.0001 && V < 0.001) o = v.toPrecision(6); + else if(V >= Math.pow(10,10) && V < Math.pow(10,11)) o = v.toFixed(10).substr(0,12); + else if(V > Math.pow(10,-9) && V < Math.pow(10,11)) { + o = v.toFixed(12).replace(/(\.[0-9]*[1-9])0*$/,"$1").replace(/\.$/,""); + if(o.length > 11+(v<0?1:0)) o = v.toPrecision(10); + if(o.length > 11+(v<0?1:0)) o = v.toExponential(5); } - else o = v.toPrecision(6); - return o.replace("e","E").replace(/\.0*$/,"").replace(/\.(.*[^0])0*$/,".$1").replace(/(E[+-])([0-9])$/,"$1"+"0"+"$2"); + else { + o = v.toFixed(11).replace(/(\.[0-9]*[1-9])0*$/,"$1") + if(o.length > 11 + (v<0?1:0)) o = v.toPrecision(6); + } + if(v==0.000000001) console.log(v, o); + o = o.replace(/(\.[0-9]*[1-9])0+e/,"$1e").replace(/\.0*e/,"e"); + return o.replace("e","E").replace(/\.0*$/,"").replace(/\.([0-9]*[^0])0*$/,".$1").replace(/(E[+-])([0-9])$/,"$1"+"0"+"$2"); } ``` @@ -209,90 +218,6 @@ of the applications makes sense here: }; ``` -These test cases were manually generated in Excel 2011 [value, code, result]: - -```json>test/implied.json -[ - [12345.6789, 0, "12345.6789"], - [12345.6789, 1, "12346"], - [12345.6789, 2, "12345.68"], - [12345.6789, 3, "12,346"], - [12345.6789, 4, "12,345.68"], - [12345.6789, 9, "1234568%"], - [12345.6789, 10, "1234567.89%"], - [12345.6789, 11, "1.23E+04"], - [12345.6789, 12, "12345 2/3"], - [12345.6789, 13, "12345 55/81"], - [12345.6789, 14, "10/18/33"], - [12345.6789, 15, "18-Oct-33"], - [12345.6789, 16, "18-Oct"], - [12345.6789, 17, "Oct-33"], - [12345.6789, 18, "4:17 PM"], - [12345.6789, 19, "4:17:37 PM"], - [12345.6789, 20, "16:17"], - [12345.6789, 21, "16:17:37"], - [12345.6789, 22, "10/18/33 16:17"], - [12345.6789, 37, "12,346"], - [12345.6789, 38, "12,346"], - [12345.6789, 39, "12,345.68"], - [12345.6789, 40, "12,345.68"], - [12345.6789, 45, "17:37"], - [12345.6789, 46, "296296:17:37"], - [12345.6789, 47, "1737.0"], - [12345.6789, 48, "12.3E+3"], - [12345.6789, 49, "12345.6789"], - - [-12345.6789, 0, "-12345.6789"], - [-12345.6789, 1, "-12346"], - [-12345.6789, 2, "-12345.68"], - [-12345.6789, 3, "-12,346"], - [-12345.6789, 4, "-12,345.68"], - [-12345.6789, 9, "-1234568%"], - [-12345.6789, 10, "-1234567.89%"], - [-12345.6789, 11, "-1.23E+04"], - [-12345.6789, 12, "-12345 2/3"], - [-12345.6789, 13, "-12345 55/81"], - [-12345.6789, 14, ""], - [-12345.6789, 15, ""], - [-12345.6789, 16, ""], - [-12345.6789, 17, ""], - [-12345.6789, 18, ""], - [-12345.6789, 19, ""], - [-12345.6789, 20, ""], - [-12345.6789, 21, ""], - [-12345.6789, 22, ""], - [-12345.6789, 37, "(12,346)"], - [-12345.6789, 38, "(12,346)"], - [-12345.6789, 39, "(12,345.68)"], - [-12345.6789, 40, "(12,345.68)"], - [-12345.6789, 45, ""], - [-12345.6789, 46, ""], - [-12345.6789, 47, ""], - [-12345.6789, 48, "-12.3E+3"], - [-12345.6789, 49, "-12345.6789"], - -``` - -These test cases emerged from formula_stress_test.xls: - - -``` - [11.666666666666666, 0, "11.66666667"], - [5.057996968497839, 0, "5.057996968"], - [4.380353866983808, 0, "4.380353867"], - [12.333333333333343, 0, "12.33333333"], - [-0.000006211546860868111, 0, "-6.21155E-06"], -``` - -Finally, these are fairly obvious: - -``` - [true, 0, "TRUE"], - [false, 0, "FALSE"], - [0, 0, "0"] -] -``` - ## Dates and Time The code `ddd` displays short day-of-week and `dddd` shows long day-of-week: @@ -857,7 +782,7 @@ test: ```json>package.json { "name": "ssf", - "version": "0.3.0", + "version": "0.3.1", "author": "SheetJS", "description": "pure-JS library to format data using ECMA-376 spreadsheet Format Codes", "keywords": [ "format", "sprintf", "spreadsheet" ], diff --git a/ssf_node.js b/ssf_node.js index aef349d..fdbd004 100644 --- a/ssf_node.js +++ b/ssf_node.js @@ -90,11 +90,20 @@ var general_fmt = function(v) { if(V >= 0.1 && V < 1) o = v.toPrecision(9); else if(V >= 0.01 && V < 0.1) o = v.toPrecision(8); else if(V >= 0.001 && V < 0.01) o = v.toPrecision(7); - else if(V > Math.pow(10,-9) && V < Math.pow(10,10)) { - o = v.toPrecision(10); if(o.length > 11+(v<0?1:0)) o = v.toExponential(5); + else if(V >= 0.0001 && V < 0.001) o = v.toPrecision(6); + else if(V >= Math.pow(10,10) && V < Math.pow(10,11)) o = v.toFixed(10).substr(0,12); + else if(V > Math.pow(10,-9) && V < Math.pow(10,11)) { + o = v.toFixed(12).replace(/(\.[0-9]*[1-9])0*$/,"$1").replace(/\.$/,""); + if(o.length > 11+(v<0?1:0)) o = v.toPrecision(10); + if(o.length > 11+(v<0?1:0)) o = v.toExponential(5); } - else o = v.toPrecision(6); - return o.replace("e","E").replace(/\.0*$/,"").replace(/\.(.*[^0])0*$/,".$1").replace(/(E[+-])([0-9])$/,"$1"+"0"+"$2"); + else { + o = v.toFixed(11).replace(/(\.[0-9]*[1-9])0*$/,"$1") + if(o.length > 11 + (v<0?1:0)) o = v.toPrecision(6); + } + if(v==0.000000001) console.log(v, o); + o = o.replace(/(\.[0-9]*[1-9])0+e/,"$1e").replace(/\.0*e/,"e"); + return o.replace("e","E").replace(/\.0*$/,"").replace(/\.([0-9]*[^0])0*$/,".$1").replace(/(E[+-])([0-9])$/,"$1"+"0"+"$2"); } if(typeof v === 'string') return v; throw "unsupported value in General format: " + v; diff --git a/test/implied.json b/test/implied.json index 695f1d9..5bc4cd4 100644 --- a/test/implied.json +++ b/test/implied.json @@ -56,12 +56,525 @@ [-12345.6789, 47, ""], [-12345.6789, 48, "-12.3E+3"], [-12345.6789, 49, "-12345.6789"], + + [1.234567E-14, 0, "1.23457E-14"], + [1.234567E-13, 0, "1.23457E-13"], + [1.234567E-12, 0, "1.23457E-12"], + [1.234567E-11, 0, "1.23457E-11"], + [1.234567E-10, 0, "1.23457E-10"], + [1.234567E-9, 0, "1.23457E-09"], + [1.234567E-8, 0, "1.23457E-08"], + [1.234567E-7, 0, "1.23457E-07"], + [1.234567E-6, 0, "1.23457E-06"], + [1.234567E-5, 0, "1.23457E-05"], + [1.234567E-4, 0, "0.000123457"], + [1.234567E-3, 0, "0.001234567"], + [1.234567E-2, 0, "0.01234567"], + [1.234567E-1, 0, "0.1234567"], + [1.234567E0, 0, "1.234567"], + [1.234567E1, 0, "12.34567"], + [1.234567E2, 0, "123.4567"], + [1.234567E3, 0, "1234.567"], + [1.234567E4, 0, "12345.67"], + [1.234567E5, 0, "123456.7"], + [1.234567E6, 0, "1234567"], + [1.234567E7, 0, "12345670"], + [1.234567E8, 0, "123456700"], + [1.234567E9, 0, "1234567000"], + [1.234567E10, 0, "12345670000"], + [1.234567E11, 0, "1.23457E+11"], + [1.234567E12, 0, "1.23457E+12"], + [1.234567E13, 0, "1.23457E+13"], + [1.234567E14, 0, "1.23457E+14"], + + [0.00000000000001, 0, "1E-14"], + [0.0000000000001, 0, "1E-13"], + [0.000000000001, 0, "1E-12"], + [0.00000000001, 0, "1E-11"], + [0.0000000001, 0, "1E-10"], + [0.000000001, 0, "0.000000001"], + [0.00000001, 0, "0.00000001"], + [0.0000001, 0, "0.0000001"], + [0.000001, 0, "0.000001"], + [0.00001, 0, "0.00001"], + [0.0001, 0, "0.0001"], + [0.001, 0, "0.001"], + [0.01, 0, "0.01"], + [0.1, 0, "0.1"], + [1, 0, "1"], + [10, 0, "10"], + [100, 0, "100"], + [1000, 0, "1000"], + [10000, 0, "10000"], + [100000, 0, "100000"], + [1000000, 0, "1000000"], + [10000000, 0, "10000000"], + [100000000, 0, "100000000"], + [1000000000, 0, "1000000000"], + [10000000000, 0, "10000000000"], + [100000000000, 0, "1E+11"], + [1000000000000, 0, "1E+12"], + [10000000000000, 0, "1E+13"], + [100000000000000, 0, "1E+14"], + + [0.000000000000012, 0, "1.2E-14"], + [0.00000000000012, 0, "1.2E-13"], + [0.0000000000012, 0, "1.2E-12"], + [0.000000000012, 0, "1.2E-11"], + [0.00000000012, 0, "1.2E-10"], + [0.0000000012, 0, "1.2E-09"], + [0.000000012, 0, "0.000000012"], + [0.00000012, 0, "0.00000012"], + [0.0000012, 0, "0.0000012"], + [0.000012, 0, "0.000012"], + [0.00012, 0, "0.00012"], + [0.0012, 0, "0.0012"], + [0.012, 0, "0.012"], + [0.12, 0, "0.12"], + [1.2, 0, "1.2"], + [12, 0, "12"], + [120, 0, "120"], + [1200, 0, "1200"], + [12000, 0, "12000"], + [120000, 0, "120000"], + [1200000, 0, "1200000"], + [12000000, 0, "12000000"], + [120000000, 0, "120000000"], + [1200000000, 0, "1200000000"], + [12000000000, 0, "12000000000"], + [120000000000, 0, "1.2E+11"], + [1200000000000, 0, "1.2E+12"], + [12000000000000, 0, "1.2E+13"], + [120000000000000, 0, "1.2E+14"], + + [0.0000000000000123, 0, "1.23E-14"], + [0.000000000000123, 0, "1.23E-13"], + [0.00000000000123, 0, "1.23E-12"], + [0.0000000000123, 0, "1.23E-11"], + [0.000000000123, 0, "1.23E-10"], + [0.00000000123, 0, "1.23E-09"], + [0.0000000123, 0, "1.23E-08"], + [0.000000123, 0, "0.000000123"], + [0.00000123, 0, "0.00000123"], + [0.0000123, 0, "0.0000123"], + [0.000123, 0, "0.000123"], + [0.00123, 0, "0.00123"], + [0.0123, 0, "0.0123"], + [0.123, 0, "0.123"], + [1.23, 0, "1.23"], + [12.3, 0, "12.3"], + [123, 0, "123"], + [1230, 0, "1230"], + [12300, 0, "12300"], + [123000, 0, "123000"], + [1230000, 0, "1230000"], + [12300000, 0, "12300000"], + [123000000, 0, "123000000"], + [1230000000, 0, "1230000000"], + [12300000000, 0, "12300000000"], + [123000000000, 0, "1.23E+11"], + [1230000000000, 0, "1.23E+12"], + [12300000000000, 0, "1.23E+13"], + [123000000000000, 0, "1.23E+14"], + + [0.00000000000001234, 0, "1.234E-14"], + [0.0000000000001234, 0, "1.234E-13"], + [0.000000000001234, 0, "1.234E-12"], + [0.00000000001234, 0, "1.234E-11"], + [0.0000000001234, 0, "1.234E-10"], + [0.000000001234, 0, "1.234E-09"], + [0.00000001234, 0, "1.234E-08"], + [0.0000001234, 0, "1.234E-07"], + [0.000001234, 0, "0.000001234"], + [0.00001234, 0, "0.00001234"], + [0.0001234, 0, "0.0001234"], + [0.001234, 0, "0.001234"], + [0.01234, 0, "0.01234"], + [0.1234, 0, "0.1234"], + [1.234, 0, "1.234"], + [12.34, 0, "12.34"], + [123.4, 0, "123.4"], + [1234, 0, "1234"], + [12340, 0, "12340"], + [123400, 0, "123400"], + [1234000, 0, "1234000"], + [12340000, 0, "12340000"], + [123400000, 0, "123400000"], + [1234000000, 0, "1234000000"], + [12340000000, 0, "12340000000"], + [123400000000, 0, "1.234E+11"], + [1234000000000, 0, "1.234E+12"], + [12340000000000, 0, "1.234E+13"], + [123400000000000, 0, "1.234E+14"], + + [0.000000000000012345, 0, "1.2345E-14"], + [0.00000000000012345, 0, "1.2345E-13"], + [0.0000000000012345, 0, "1.2345E-12"], + [0.000000000012345, 0, "1.2345E-11"], + [0.00000000012345, 0, "1.2345E-10"], + [0.0000000012345, 0, "1.2345E-09"], + [0.000000012345, 0, "1.2345E-08"], + [0.00000012345, 0, "1.2345E-07"], + [0.0000012345, 0, "1.2345E-06"], + [0.000012345, 0, "0.000012345"], + [0.00012345, 0, "0.00012345"], + [0.0012345, 0, "0.0012345"], + [0.012345, 0, "0.012345"], + [0.12345, 0, "0.12345"], + [1.2345, 0, "1.2345"], + [12.345, 0, "12.345"], + [123.45, 0, "123.45"], + [1234.5, 0, "1234.5"], + [12345, 0, "12345"], + [123450, 0, "123450"], + [1234500, 0, "1234500"], + [12345000, 0, "12345000"], + [123450000, 0, "123450000"], + [1234500000, 0, "1234500000"], + [12345000000, 0, "12345000000"], + [123450000000, 0, "1.2345E+11"], + [1234500000000, 0, "1.2345E+12"], + [12345000000000, 0, "1.2345E+13"], + [123450000000000, 0, "1.2345E+14"], + + [0.0000000000000123456, 0, "1.23456E-14"], + [0.000000000000123456, 0, "1.23456E-13"], + [0.00000000000123456, 0, "1.23456E-12"], + [0.0000000000123456, 0, "1.23456E-11"], + [0.000000000123456, 0, "1.23456E-10"], + [0.00000000123456, 0, "1.23456E-09"], + [0.0000000123456, 0, "1.23456E-08"], + [0.000000123456, 0, "1.23456E-07"], + [0.00000123456, 0, "1.23456E-06"], + [0.0000123456, 0, "1.23456E-05"], + [0.000123456, 0, "0.000123456"], + [0.00123456, 0, "0.00123456"], + [0.0123456, 0, "0.0123456"], + [0.123456, 0, "0.123456"], + [1.23456, 0, "1.23456"], + [12.3456, 0, "12.3456"], + [123.456, 0, "123.456"], + [1234.56, 0, "1234.56"], + [12345.6, 0, "12345.6"], + [123456, 0, "123456"], + [1234560, 0, "1234560"], + [12345600, 0, "12345600"], + [123456000, 0, "123456000"], + [1234560000, 0, "1234560000"], + [12345600000, 0, "12345600000"], + [123456000000, 0, "1.23456E+11"], + [1234560000000, 0, "1.23456E+12"], + [12345600000000, 0, "1.23456E+13"], + [123456000000000, 0, "1.23456E+14"], + + [0.00000000000001234567, 0, "1.23457E-14"], + [0.0000000000001234567, 0, "1.23457E-13"], + [0.000000000001234567, 0, "1.23457E-12"], + [0.00000000001234567, 0, "1.23457E-11"], + [0.0000000001234567, 0, "1.23457E-10"], + [0.000000001234567, 0, "1.23457E-09"], + [0.00000001234567, 0, "1.23457E-08"], + [0.0000001234567, 0, "1.23457E-07"], + [0.000001234567, 0, "1.23457E-06"], + [0.00001234567, 0, "1.23457E-05"], + [0.0001234567, 0, "0.000123457"], + [0.001234567, 0, "0.001234567"], + [0.01234567, 0, "0.01234567"], + [0.1234567, 0, "0.1234567"], + [1.234567, 0, "1.234567"], + [12.34567, 0, "12.34567"], + [123.4567, 0, "123.4567"], + [1234.567, 0, "1234.567"], + [12345.67, 0, "12345.67"], + [123456.7, 0, "123456.7"], + [1234567, 0, "1234567"], + [12345670, 0, "12345670"], + [123456700, 0, "123456700"], + [1234567000, 0, "1234567000"], + [12345670000, 0, "12345670000"], + [123456700000, 0, "1.23457E+11"], + [1234567000000, 0, "1.23457E+12"], + [12345670000000, 0, "1.23457E+13"], + [123456700000000, 0, "1.23457E+14"], + + [0.000000000000012345678, 0, "1.23457E-14"], + [0.00000000000012345678, 0, "1.23457E-13"], + [0.0000000000012345678, 0, "1.23457E-12"], + [0.000000000012345678, 0, "1.23457E-11"], + [0.00000000012345678, 0, "1.23457E-10"], + [0.0000000012345678, 0, "1.23457E-09"], + [0.000000012345678, 0, "1.23457E-08"], + [0.00000012345678, 0, "1.23457E-07"], + [0.0000012345678, 0, "1.23457E-06"], + [0.000012345678, 0, "1.23457E-05"], + [0.00012345678, 0, "0.000123457"], + [0.0012345678, 0, "0.001234568"], + [0.012345678, 0, "0.012345678"], + [0.12345678, 0, "0.12345678"], + [1.2345678, 0, "1.2345678"], + [12.345678, 0, "12.345678"], + [123.45678, 0, "123.45678"], + [1234.5678, 0, "1234.5678"], + [12345.678, 0, "12345.678"], + [123456.78, 0, "123456.78"], + [1234567.8, 0, "1234567.8"], + [12345678, 0, "12345678"], + [123456780, 0, "123456780"], + [1234567800, 0, "1234567800"], + [12345678000, 0, "12345678000"], + [123456780000, 0, "1.23457E+11"], + [1234567800000, 0, "1.23457E+12"], + [12345678000000, 0, "1.23457E+13"], + [123456780000000, 0, "1.23457E+14"], + + [0.0000000000000123456789, 0, "1.23457E-14"], + [0.000000000000123456789, 0, "1.23457E-13"], + [0.00000000000123456789, 0, "1.23457E-12"], + [0.0000000000123456789, 0, "1.23457E-11"], + [0.000000000123456789, 0, "1.23457E-10"], + [0.00000000123456789, 0, "1.23457E-09"], + [0.0000000123456789, 0, "1.23457E-08"], + [0.000000123456789, 0, "1.23457E-07"], + [0.00000123456789, 0, "1.23457E-06"], + [0.0000123456789, 0, "1.23457E-05"], + [0.000123456789, 0, "0.000123457"], + [0.00123456789, 0, "0.001234568"], + [0.0123456789, 0, "0.012345679"], + [0.123456789, 0, "0.123456789"], + [1.23456789, 0, "1.23456789"], + [12.3456789, 0, "12.3456789"], + [123.456789, 0, "123.456789"], + [1234.56789, 0, "1234.56789"], + [12345.6789, 0, "12345.6789"], + [123456.789, 0, "123456.789"], + [1234567.89, 0, "1234567.89"], + [12345678.9, 0, "12345678.9"], + [123456789, 0, "123456789"], + [1234567890, 0, "1234567890"], + [12345678900, 0, "12345678900"], + [123456789000, 0, "1.23457E+11"], + [1234567890000, 0, "1.23457E+12"], + [12345678900000, 0, "1.23457E+13"], + [123456789000000, 0, "1.23457E+14"], + + [0.00000000000001234567891, 0, "1.23457E-14"], + [0.0000000000001234567891, 0, "1.23457E-13"], + [0.000000000001234567891, 0, "1.23457E-12"], + [0.00000000001234567891, 0, "1.23457E-11"], + [0.0000000001234567891, 0, "1.23457E-10"], + [0.000000001234567891, 0, "1.23457E-09"], + [0.00000001234567891, 0, "1.23457E-08"], + [0.0000001234567891, 0, "1.23457E-07"], + [0.000001234567891, 0, "1.23457E-06"], + [0.00001234567891, 0, "1.23457E-05"], + [0.0001234567891, 0, "0.000123457"], + [0.001234567891, 0, "0.001234568"], + [0.01234567891, 0, "0.012345679"], + [0.1234567891, 0, "0.123456789"], + [1.234567891, 0, "1.234567891"], + [12.34567891, 0, "12.34567891"], + [123.4567891, 0, "123.4567891"], + [1234.567891, 0, "1234.567891"], + [12345.67891, 0, "12345.67891"], + [123456.7891, 0, "123456.7891"], + [1234567.891, 0, "1234567.891"], + [12345678.91, 0, "12345678.91"], + [123456789.1, 0, "123456789.1"], + [1234567891, 0, "1234567891"], + [12345678910, 0, "12345678910"], + [123456789100, 0, "1.23457E+11"], + [1234567891000, 0, "1.23457E+12"], + [12345678910000, 0, "1.23457E+13"], + [123456789100000, 0, "1.23457E+14"], + + [0.000000000000012345678912, 0, "1.23457E-14"], + [0.00000000000012345678912, 0, "1.23457E-13"], + [0.0000000000012345678912, 0, "1.23457E-12"], + [0.000000000012345678912, 0, "1.23457E-11"], + [0.00000000012345678912, 0, "1.23457E-10"], + [0.0000000012345678912, 0, "1.23457E-09"], + [0.000000012345678912, 0, "1.23457E-08"], + [0.00000012345678912, 0, "1.23457E-07"], + [0.0000012345678912, 0, "1.23457E-06"], + [0.000012345678912, 0, "1.23457E-05"], + [0.00012345678912, 0, "0.000123457"], + [0.0012345678912, 0, "0.001234568"], + [0.012345678912, 0, "0.012345679"], + [0.12345678912, 0, "0.123456789"], + [1.2345678912, 0, "1.234567891"], + [12.345678912, 0, "12.34567891"], + [123.45678912, 0, "123.4567891"], + [1234.5678912, 0, "1234.567891"], + [12345.678912, 0, "12345.67891"], + [123456.78912, 0, "123456.7891"], + [1234567.8912, 0, "1234567.891"], + [12345678.912, 0, "12345678.91"], + [123456789.12, 0, "123456789.1"], + [1234567891.2, 0, "1234567891"], + [12345678912, 0, "12345678912"], + [123456789120, 0, "1.23457E+11"], + [1234567891200, 0, "1.23457E+12"], + [12345678912000, 0, "1.23457E+13"], + [123456789120000, 0, "1.23457E+14"], + + [0.0000000000000123456789123, 0, "1.23457E-14"], + [0.000000000000123456789123, 0, "1.23457E-13"], + [0.00000000000123456789123, 0, "1.23457E-12"], + [0.0000000000123456789123, 0, "1.23457E-11"], + [0.000000000123456789123, 0, "1.23457E-10"], + [0.00000000123456789123, 0, "1.23457E-09"], + [0.0000000123456789123, 0, "1.23457E-08"], + [0.000000123456789123, 0, "1.23457E-07"], + [0.00000123456789123, 0, "1.23457E-06"], + [0.0000123456789123, 0, "1.23457E-05"], + [0.000123456789123, 0, "0.000123457"], + [0.00123456789123, 0, "0.001234568"], + [0.0123456789123, 0, "0.012345679"], + [0.123456789123, 0, "0.123456789"], + [1.23456789123, 0, "1.234567891"], + [12.3456789123, 0, "12.34567891"], + [123.456789123, 0, "123.4567891"], + [1234.56789123, 0, "1234.567891"], + [12345.6789123, 0, "12345.67891"], + [123456.789123, 0, "123456.7891"], + [1234567.89123, 0, "1234567.891"], + [12345678.9123, 0, "12345678.91"], + [123456789.123, 0, "123456789.1"], + [1234567891.23, 0, "1234567891"], + [12345678912.3, 0, "12345678912"], + [123456789123, 0, "1.23457E+11"], + [1234567891230, 0, "1.23457E+12"], + [12345678912300, 0, "1.23457E+13"], + [123456789123000, 0, "1.23457E+14"], + + [0.00000000000001234567891234, 0, "1.23457E-14"], + [0.0000000000001234567891234, 0, "1.23457E-13"], + [0.000000000001234567891234, 0, "1.23457E-12"], + [0.00000000001234567891234, 0, "1.23457E-11"], + [0.0000000001234567891234, 0, "1.23457E-10"], + [0.000000001234567891234, 0, "1.23457E-09"], + [0.00000001234567891234, 0, "1.23457E-08"], + [0.0000001234567891234, 0, "1.23457E-07"], + [0.000001234567891234, 0, "1.23457E-06"], + [0.00001234567891234, 0, "1.23457E-05"], + [0.0001234567891234, 0, "0.000123457"], + [0.001234567891234, 0, "0.001234568"], + [0.01234567891234, 0, "0.012345679"], + [0.1234567891234, 0, "0.123456789"], + [1.234567891234, 0, "1.234567891"], + [12.34567891234, 0, "12.34567891"], + [123.4567891234, 0, "123.4567891"], + [1234.567891234, 0, "1234.567891"], + [12345.67891234, 0, "12345.67891"], + [123456.7891234, 0, "123456.7891"], + [1234567.891234, 0, "1234567.891"], + [12345678.91234, 0, "12345678.91"], + [123456789.1234, 0, "123456789.1"], + [1234567891.234, 0, "1234567891"], + [12345678912.34, 0, "12345678912"], + [123456789123.4, 0, "1.23457E+11"], + [1234567891234, 0, "1.23457E+12"], + [12345678912340, 0, "1.23457E+13"], + [123456789123400, 0, "1.23457E+14"], + + [0.000000000000012345678912345, 0, "1.23457E-14"], + [0.00000000000012345678912345, 0, "1.23457E-13"], + [0.0000000000012345678912345, 0, "1.23457E-12"], + [0.000000000012345678912345, 0, "1.23457E-11"], + [0.00000000012345678912345, 0, "1.23457E-10"], + [0.0000000012345678912345, 0, "1.23457E-09"], + [0.000000012345678912345, 0, "1.23457E-08"], + [0.00000012345678912345, 0, "1.23457E-07"], + [0.0000012345678912345, 0, "1.23457E-06"], + [0.000012345678912345, 0, "1.23457E-05"], + [0.00012345678912345, 0, "0.000123457"], + [0.0012345678912345, 0, "0.001234568"], + [0.012345678912345, 0, "0.012345679"], + [0.12345678912345, 0, "0.123456789"], + [1.2345678912345, 0, "1.234567891"], + [12.345678912345, 0, "12.34567891"], + [123.45678912345, 0, "123.4567891"], + [1234.5678912345, 0, "1234.567891"], + [12345.678912345, 0, "12345.67891"], + [123456.78912345, 0, "123456.7891"], + [1234567.8912345, 0, "1234567.891"], + [12345678.912345, 0, "12345678.91"], + [123456789.12345, 0, "123456789.1"], + [1234567891.2345, 0, "1234567891"], + [12345678912.345, 0, "12345678912"], + [123456789123.45, 0, "1.23457E+11"], + [1234567891234.5, 0, "1.23457E+12"], + [12345678912345, 0, "1.23457E+13"], + [123456789123450, 0, "1.23457E+14"], + + [0.0000000000000123456789123456, 0, "1.23457E-14"], + [0.000000000000123456789123456, 0, "1.23457E-13"], + [0.00000000000123456789123456, 0, "1.23457E-12"], + [0.0000000000123456789123456, 0, "1.23457E-11"], + [0.000000000123456789123456, 0, "1.23457E-10"], + [0.00000000123456789123456, 0, "1.23457E-09"], + [0.0000000123456789123456, 0, "1.23457E-08"], + [0.000000123456789123456, 0, "1.23457E-07"], + [0.00000123456789123456, 0, "1.23457E-06"], + [0.0000123456789123456, 0, "1.23457E-05"], + [0.000123456789123456, 0, "0.000123457"], + [0.00123456789123456, 0, "0.001234568"], + [0.0123456789123456, 0, "0.012345679"], + [0.123456789123456, 0, "0.123456789"], + [1.23456789123456, 0, "1.234567891"], + [12.3456789123456, 0, "12.34567891"], + [123.456789123456, 0, "123.4567891"], + [1234.56789123456, 0, "1234.567891"], + [12345.6789123456, 0, "12345.67891"], + [123456.789123456, 0, "123456.7891"], + [1234567.89123456, 0, "1234567.891"], + [12345678.9123456, 0, "12345678.91"], + [123456789.123456, 0, "123456789.1"], + [1234567891.23456, 0, "1234567891"], + [12345678912.3456, 0, "12345678912"], + [123456789123.456, 0, "1.23457E+11"], + [1234567891234.56, 0, "1.23457E+12"], + [12345678912345.6, 0, "1.23457E+13"], + [123456789123456, 0, "1.23457E+14"], + + [-0.00000000000001234567, 0, "-1.23457E-14"], + [-0.0000000000001234567, 0, "-1.23457E-13"], + [-0.000000000001234567, 0, "-1.23457E-12"], + [-0.00000000001234567, 0, "-1.23457E-11"], + [-0.0000000001234567, 0, "-1.23457E-10"], + [-0.000000001234567, 0, "-1.23457E-09"], + [-0.00000001234567, 0, "-1.23457E-08"], + [-0.0000001234567, 0, "-1.23457E-07"], + [-0.000001234567, 0, "-1.23457E-06"], + [-0.00001234567, 0, "-1.23457E-05"], + [-0.0001234567, 0, "-0.000123457"], + [-0.001234567, 0, "-0.001234567"], + [-0.01234567, 0, "-0.01234567"], + [-0.1234567, 0, "-0.1234567"], + [-1.234567, 0, "-1.234567"], + [-12.34567, 0, "-12.34567"], + [-123.4567, 0, "-123.4567"], + [-1234.567, 0, "-1234.567"], + [-12345.67, 0, "-12345.67"], + [-123456.7, 0, "-123456.7"], + [-1234567, 0, "-1234567"], + [-12345670, 0, "-12345670"], + [-123456700, 0, "-123456700"], + [-1234567000, 0, "-1234567000"], + [-12345670000, 0, "-12345670000"], + [-123456700000, 0, "-1.23457E+11"], + [-1234567000000, 0, "-1.23457E+12"], + [-12345670000000, 0, "-1.23457E+13"], + [-123456700000000, 0, "-1.23457E+14"], + + [true, 0, "TRUE"], + [false, 0, "FALSE"], + [11.666666666666666, 0, "11.66666667"], [5.057996968497839, 0, "5.057996968"], [4.380353866983808, 0, "4.380353867"], [12.333333333333343, 0, "12.33333333"], [-0.000006211546860868111, 0, "-6.21155E-06"], - [true, 0, "TRUE"], - [false, 0, "FALSE"], + [0, 0, "0"] ]