X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph-utils.js;h=ffedb27a19717f14a3825ac554deb2579535adea;hb=2fd143d3e284124506b00e4afa9e29f9de636543;hp=05542044e8e1f885103afac9300af2999d79a5a1;hpb=3c043a9c7f1c44aaffaa9dbb79a890b991bfeabe;p=dygraphs.git diff --git a/dygraph-utils.js b/dygraph-utils.js index 0554204..ffedb27 100644 --- a/dygraph-utils.js +++ b/dygraph-utils.js @@ -1233,3 +1233,15 @@ Dygraph.isElementContainedBy = function(containee, container) { } return (containee === container); }; + + +// This masks some numeric issues in older versions of Firefox, +// where 1.0/Math.pow(10,2) != Math.pow(10,-2). +/** @type {function(number,number):number} */ +Dygraph.pow = function(base, exp) { + if (exp < 0) { + return 1.0 / Math.pow(base, -exp); + } + return Math.pow(base, exp); +}; +