14 lines
538 B
JavaScript
14 lines
538 B
JavaScript
|
'use strict';
|
||
|
var floatRound = require('../internals/math-float-round');
|
||
|
|
||
|
var FLOAT32_EPSILON = 1.1920928955078125e-7; // 2 ** -23;
|
||
|
var FLOAT32_MAX_VALUE = 3.4028234663852886e+38; // 2 ** 128 - 2 ** 104
|
||
|
var FLOAT32_MIN_VALUE = 1.1754943508222875e-38; // 2 ** -126;
|
||
|
|
||
|
// `Math.fround` method implementation
|
||
|
// https://tc39.es/ecma262/#sec-math.fround
|
||
|
// eslint-disable-next-line es/no-math-fround -- safe
|
||
|
module.exports = Math.fround || function fround(x) {
|
||
|
return floatRound(x, FLOAT32_EPSILON, FLOAT32_MAX_VALUE, FLOAT32_MIN_VALUE);
|
||
|
};
|