Sha256: 3a4fe440d972ddcf267bb43968091fb94c36b57ac42478eee7191ba688128b36

Contents?: true

Size: 804 Bytes

Versions: 25

Compression:

Stored size: 804 Bytes

Contents

var sign = require('../internals/math-sign');

var abs = Math.abs;
var pow = Math.pow;
var EPSILON = pow(2, -52);
var EPSILON32 = pow(2, -23);
var MAX32 = pow(2, 127) * (2 - EPSILON32);
var MIN32 = pow(2, -126);

var roundTiesToEven = function (n) {
  return n + 1 / EPSILON - 1 / EPSILON;
};

// `Math.fround` method implementation
// https://tc39.github.io/ecma262/#sec-math.fround
module.exports = Math.fround || function fround(x) {
  var $abs = abs(x);
  var $sign = sign(x);
  var a, result;
  if ($abs < MIN32) return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32;
  a = (1 + EPSILON32 / EPSILON) * $abs;
  result = a - (a - $abs);
  // eslint-disable-next-line no-self-compare
  if (result > MAX32 || result != result) return $sign * Infinity;
  return $sign * result;
};

Version data entries

25 entries across 25 versions & 7 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/core-js/internals/math-fround.js
disco_app-0.18.0 test/dummy/node_modules/core-js/internals/math-fround.js
disco_app-0.18.2 test/dummy/node_modules/core-js/internals/math-fround.js
tang-0.2.1 spec/tang_app/node_modules/core-js/internals/math-fround.js
tang-0.2.0 spec/tang_app/node_modules/core-js/internals/math-fround.js
tang-0.1.0 spec/tang_app/node_modules/core-js/internals/math-fround.js
tang-0.0.9 spec/tang_app/node_modules/core-js/internals/math-fround.js
enju_library-0.3.8 spec/dummy/node_modules/core-js/internals/math-fround.js
condenser-0.3 lib/condenser/processors/node_modules/core-js-pure/internals/math-fround.js
condenser-0.2 lib/condenser/processors/node_modules/core-js-pure/internals/math-fround.js
condenser-0.1 lib/condenser/processors/node_modules/core-js-pure/internals/math-fround.js
condenser-0.0.12 lib/condenser/processors/node_modules/core-js-pure/internals/math-fround.js
condenser-0.0.11 lib/condenser/processors/node_modules/core-js-pure/internals/math-fround.js
condenser-0.0.10 lib/condenser/processors/node_modules/core-js-pure/internals/math-fround.js
condenser-0.0.9 lib/condenser/processors/node_modules/core-js-pure/internals/math-fround.js
condenser-0.0.8 lib/condenser/processors/node_modules/core-js-pure/internals/math-fround.js
jester-data-8.0.0 node_modules/core-js/internals/math-fround.js
ezii-os-5.2.1 node_modules/core-js/internals/math-fround.js
ezii-os-2.0.1 node_modules/core-js/internals/math-fround.js
ezii-os-1.1.0 node_modules/core-js/internals/math-fround.js