Initial Save
This commit is contained in:
19
node_modules/core-js-pure/internals/math-float-round.js
generated
vendored
Normal file
19
node_modules/core-js-pure/internals/math-float-round.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
var sign = require('../internals/math-sign');
|
||||
var roundTiesToEven = require('../internals/math-round-ties-to-even');
|
||||
|
||||
var abs = Math.abs;
|
||||
|
||||
var EPSILON = 2.220446049250313e-16; // Number.EPSILON
|
||||
|
||||
module.exports = function (x, FLOAT_EPSILON, FLOAT_MAX_VALUE, FLOAT_MIN_VALUE) {
|
||||
var n = +x;
|
||||
var absolute = abs(n);
|
||||
var s = sign(n);
|
||||
if (absolute < FLOAT_MIN_VALUE) return s * roundTiesToEven(absolute / FLOAT_MIN_VALUE / FLOAT_EPSILON) * FLOAT_MIN_VALUE * FLOAT_EPSILON;
|
||||
var a = (1 + FLOAT_EPSILON / EPSILON) * absolute;
|
||||
var result = a - (a - absolute);
|
||||
// eslint-disable-next-line no-self-compare -- NaN check
|
||||
if (result > FLOAT_MAX_VALUE || result !== result) return s * Infinity;
|
||||
return s * result;
|
||||
};
|
||||
Reference in New Issue
Block a user