Sha256: 4fb1a84cbbdfcdbccbbb11e73b1c91380df3b9dcac357570a6b36bc4f0257ad1

Contents?: true

Size: 745 Bytes

Versions: 34

Compression:

Stored size: 745 Bytes

Contents

// 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;
  }
});

Version data entries

34 entries across 17 versions & 7 rubygems

Version Path
ilog-0.4.1 node_modules/core-js/modules/es6.math.fround.js
ilog-0.4.1 node_modules/core-js/library/modules/es6.math.fround.js
ilog-0.4.0 node_modules/core-js/modules/es6.math.fround.js
ilog-0.4.0 node_modules/core-js/library/modules/es6.math.fround.js
ilog-0.3.3 node_modules/core-js/modules/es6.math.fround.js
ilog-0.3.3 node_modules/core-js/library/modules/es6.math.fround.js
locomotivecms-4.0.0.alpha1 app/javascript/node_modules/fbjs/node_modules/core-js/library/modules/es6.math.fround.js
locomotivecms-4.0.0.alpha1 app/javascript/node_modules/fbjs/node_modules/core-js/modules/es6.math.fround.js
locomotivecms-3.4.0 app/javascript/node_modules/fbjs/node_modules/core-js/library/modules/es6.math.fround.js
locomotivecms-3.4.0 app/javascript/node_modules/fbjs/node_modules/core-js/modules/es6.math.fround.js
cortex-0.1.3 spec/dummy/node_modules/fbjs/node_modules/core-js/library/modules/es6.math.fround.js
cortex-0.1.3 spec/dummy/node_modules/fbjs/node_modules/core-js/modules/es6.math.fround.js
lanes-0.8.0 node_modules/core-js/library/modules/es6.math.fround.js
lanes-0.8.0 node_modules/core-js/modules/es6.math.fround.js
xcodebuild-helper-1.2.5 externals/ios-sim-master/node_modules/core-js/library/modules/es6.math.fround.js
xcodebuild-helper-1.2.5 externals/ios-sim-master/node_modules/core-js/modules/es6.math.fround.js
xcodebuild-helper-1.2.3 externals/ios-sim-master/node_modules/core-js/library/modules/es6.math.fround.js
xcodebuild-helper-1.2.3 externals/ios-sim-master/node_modules/core-js/modules/es6.math.fround.js
babel-schmooze-sprockets-0.1.3 node_modules/core-js/modules/es6.math.fround.js
babel-schmooze-sprockets-0.1.3 node_modules/core-js/library/modules/es6.math.fround.js