X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=node_modules%2Fcore-js%2Fmodules%2Fes6.math.fround.js;fp=node_modules%2Fcore-js%2Fmodules%2Fes6.math.fround.js;h=01a88862efc791748ef015701e90c7573e436ab2;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/node_modules/core-js/modules/es6.math.fround.js b/node_modules/core-js/modules/es6.math.fround.js new file mode 100644 index 000000000..01a88862e --- /dev/null +++ b/node_modules/core-js/modules/es6.math.fround.js @@ -0,0 +1,26 @@ +// 20.2.2.16 Math.fround(x) +var $export = require('./_export') + , sign = require('./_math-sign') + , pow = Math.pow + , EPSILON = pow(2, -52) + , EPSILON32 = pow(2, -23) + , MAX32 = pow(2, 127) * (2 - EPSILON32) + , MIN32 = pow(2, -126); + +var roundTiesToEven = function(n){ + return n + 1 / EPSILON - 1 / EPSILON; +}; + + +$export($export.S, 'Math', { + fround: function fround(x){ + var $abs = Math.abs(x) + , $sign = sign(x) + , a, result; + if($abs < MIN32)return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32; + a = (1 + EPSILON32 / EPSILON) * $abs; + result = a - (a - $abs); + if(result > MAX32 || result != result)return $sign * Infinity; + return $sign * result; + } +}); \ No newline at end of file