source: trip-planner-front/node_modules/core-js/internals/math-fround.js@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 864 bytes
Line 
1var sign = require('../internals/math-sign');
2
3var abs = Math.abs;
4var pow = Math.pow;
5var EPSILON = pow(2, -52);
6var EPSILON32 = pow(2, -23);
7var MAX32 = pow(2, 127) * (2 - EPSILON32);
8var MIN32 = pow(2, -126);
9
10var roundTiesToEven = function (n) {
11 return n + 1 / EPSILON - 1 / EPSILON;
12};
13
14// `Math.fround` method implementation
15// https://tc39.es/ecma262/#sec-math.fround
16// eslint-disable-next-line es/no-math-fround -- safe
17module.exports = Math.fround || function fround(x) {
18 var $abs = abs(x);
19 var $sign = sign(x);
20 var a, result;
21 if ($abs < MIN32) return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32;
22 a = (1 + EPSILON32 / EPSILON) * $abs;
23 result = a - (a - $abs);
24 // eslint-disable-next-line no-self-compare -- NaN check
25 if (result > MAX32 || result != result) return $sign * Infinity;
26 return $sign * result;
27};
Note: See TracBrowser for help on using the repository browser.