X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fnumber-format.html;h=23aacf8c80442e9dfcd9721ea71aef2e5589727b;hb=c84d136cf6c4dac8e61f4a976487e14b72d4541a;hp=e17a15c41208031bf61aa4ad6e8af2fbb97d17bd;hpb=15b00ba8914e0da9ad5dca2917d7743004485e73;p=dygraphs.git diff --git a/tests/number-format.html b/tests/number-format.html index e17a15c..23aacf8 100644 --- a/tests/number-format.html +++ b/tests/number-format.html @@ -1,13 +1,17 @@ +
+The default formatting mimicks printf with %.pg where p is @@ -58,21 +62,21 @@ }; updateTable = function() { - var headers = ['Dygraph.defaultFormat()', 'toPrecision()', - 'Dygraph.defaultFormat()', 'toPrecision()']; + var headers = ['Dygraph.floatFormat()', 'toPrecision()', + 'Dygraph.floatFormat()', 'toPrecision()']; var numbers = []; var p = parseInt(document.getElementById('p_input').value); for (var i = -10; i <= 10; i++) { var n = Math.pow(10, i); - numbers.push([Dygraph.defaultFormat(n, p), + numbers.push([Dygraph.floatFormat(n, p), n.toPrecision(p), - Dygraph.defaultFormat(Math.PI * n, p), + Dygraph.floatFormat(Math.PI * n, p), (Math.PI * n).toPrecision(p)]); } // Check exact values of 0. - numbers.push([Dygraph.defaultFormat(0.0, p), + numbers.push([Dygraph.floatFormat(0.0, p), 0.0.toPrecision(p)]); var elem = document.getElementById('content');