mirror of
https://github.com/hanzoai/core-js.git
synced 2026-09-24 16:58:15 +00:00
move Math.f16round and DataView.prototype.{ getFloat16, setFloat16 } to stable ES
This commit is contained in:
@@ -5,6 +5,13 @@
|
||||
- `RegExp.escape`
|
||||
- Moved to stable ES, [February 2025 TC39 meeting](https://github.com/tc39/proposals/commit/b81fa9bccf4b51f33de0cbe797976a84d05d4b76)
|
||||
- Added `es.` namespace module, `/es/` and `/stable/` namespaces entries
|
||||
- [`Float16` proposal](https://github.com/tc39/proposal-regex-escaping):
|
||||
- Built-ins:
|
||||
- `Math.f16round`
|
||||
- `DataView.prototype.getFloat16`
|
||||
- `DataView.prototype.setFloat16`
|
||||
- Moved to stable ES, February 2025 TC39 meeting
|
||||
- Added `es.` namespace modules, `/es/` and `/stable/` namespaces entries
|
||||
- Compat data improvements:
|
||||
- [`DisposableStack`, `AsyncDisposableStack`, `SuppressedError` and `Iterator.prototype[@@dispose]`](https://github.com/tc39/proposal-explicit-resource-management) marked as [shipped from V8 ~ Chromium 134](https://issues.chromium.org/issues/42203506#comment24)
|
||||
- [`Error.isError`](https://github.com/tc39/proposal-is-error) added and marked as supported from V8 ~ Chromium 134
|
||||
|
||||
@@ -486,6 +486,18 @@ export const data = {
|
||||
rhino: '1.7.13',
|
||||
safari: '7.1',
|
||||
},
|
||||
'es.data-view.get-float16': {
|
||||
bun: '1.1.23',
|
||||
deno: '1.43',
|
||||
firefox: '129',
|
||||
safari: '18.2',
|
||||
},
|
||||
'es.data-view.set-float16': {
|
||||
bun: '1.1.23',
|
||||
deno: '1.43',
|
||||
firefox: '129',
|
||||
safari: '18.2',
|
||||
},
|
||||
'es.array-buffer.detached': {
|
||||
bun: '1.0.19',
|
||||
chrome: '114',
|
||||
@@ -793,6 +805,12 @@ export const data = {
|
||||
rhino: '1.7.13',
|
||||
safari: '7.1',
|
||||
},
|
||||
'es.math.f16round': {
|
||||
bun: '1.1.23',
|
||||
deno: '1.43',
|
||||
firefox: '129',
|
||||
safari: '18.2',
|
||||
},
|
||||
'es.math.hypot': {
|
||||
// https://bugs.chromium.org/p/v8/issues/detail?id=9546
|
||||
chrome: '78', // '38',
|
||||
@@ -2295,20 +2313,12 @@ export const data = {
|
||||
},
|
||||
'esnext.composite-symbol': {
|
||||
},
|
||||
'esnext.data-view.get-float16': {
|
||||
bun: '1.1.23',
|
||||
deno: '1.43',
|
||||
firefox: '129',
|
||||
safari: '18.2',
|
||||
},
|
||||
// TODO: Remove from `core-js@4`
|
||||
'esnext.data-view.get-float16': null,
|
||||
'esnext.data-view.get-uint8-clamped': {
|
||||
},
|
||||
'esnext.data-view.set-float16': {
|
||||
bun: '1.1.23',
|
||||
deno: '1.43',
|
||||
firefox: '129',
|
||||
safari: '18.2',
|
||||
},
|
||||
// TODO: Remove from `core-js@4`
|
||||
'esnext.data-view.set-float16': null,
|
||||
'esnext.data-view.set-uint8-clamped': {
|
||||
},
|
||||
'esnext.disposable-stack.constructor': {
|
||||
@@ -2449,12 +2459,8 @@ export const data = {
|
||||
},
|
||||
'esnext.math.fscale': {
|
||||
},
|
||||
'esnext.math.f16round': {
|
||||
bun: '1.1.23',
|
||||
deno: '1.43',
|
||||
firefox: '129',
|
||||
safari: '18.2',
|
||||
},
|
||||
// TODO: Remove from `core-js@4`
|
||||
'esnext.math.f16round': null,
|
||||
// TODO: Remove from `core-js@4`
|
||||
'esnext.math.iaddh': {
|
||||
},
|
||||
@@ -3000,6 +3006,8 @@ export const renamed = new Map([
|
||||
['esnext.array-buffer.transfer', 'es.array-buffer.transfer'],
|
||||
['esnext.array-buffer.transfer-to-fixed-length', 'es.array-buffer.transfer-to-fixed-length'],
|
||||
['esnext.aggregate-error', 'es.aggregate-error'],
|
||||
['esnext.data-view.get-float16', 'es.data-view.get-float16'],
|
||||
['esnext.data-view.set-float16', 'es.data-view.set-float16'],
|
||||
['esnext.global-this', 'es.global-this'],
|
||||
['esnext.iterator.constructor', 'es.iterator.constructor'],
|
||||
['esnext.iterator.drop', 'es.iterator.drop'],
|
||||
@@ -3015,6 +3023,7 @@ export const renamed = new Map([
|
||||
['esnext.iterator.take', 'es.iterator.take'],
|
||||
['esnext.iterator.to-array', 'es.iterator.to-array'],
|
||||
['esnext.map.group-by', 'es.map.group-by'],
|
||||
['esnext.math.f16round', 'es.math.f16round'],
|
||||
['esnext.object.has-own', 'es.object.has-own'],
|
||||
['esnext.object.group-by', 'es.object.group-by'],
|
||||
['esnext.promise.all-settled', 'es.promise.all-settled'],
|
||||
|
||||
@@ -278,6 +278,9 @@ export default {
|
||||
'esnext.error.is-error',
|
||||
],
|
||||
3.41: [
|
||||
'es.data-view.get-float16',
|
||||
'es.data-view.set-float16',
|
||||
'es.math.f16round',
|
||||
'es.regexp.escape',
|
||||
],
|
||||
};
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
// empty
|
||||
@@ -0,0 +1 @@
|
||||
// empty
|
||||
@@ -1,2 +1,5 @@
|
||||
'use strict';
|
||||
var parent = require('../../stable/data-view/get-float16');
|
||||
require('../../modules/esnext.data-view.get-float16');
|
||||
|
||||
module.exports = parent;
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
'use strict';
|
||||
var parent = require('../../stable/data-view/set-float16');
|
||||
require('../../modules/esnext.data-view.set-float16');
|
||||
|
||||
module.exports = parent;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
'use strict';
|
||||
var parent = require('../../stable/math/f16round');
|
||||
require('../../modules/esnext.math.f16round');
|
||||
var path = require('../../internals/path');
|
||||
|
||||
module.exports = path.Math.f16round;
|
||||
module.exports = parent;
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
require('../../modules/es.data-view.get-float16');
|
||||
@@ -2,6 +2,8 @@
|
||||
require('../../modules/es.array-buffer.constructor');
|
||||
require('../../modules/es.array-buffer.slice');
|
||||
require('../../modules/es.data-view');
|
||||
require('../../modules/es.data-view.get-float16');
|
||||
require('../../modules/es.data-view.set-float16');
|
||||
require('../../modules/es.object.to-string');
|
||||
var path = require('../../internals/path');
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
require('../../modules/es.data-view.set-float16');
|
||||
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
require('../../modules/es.math.f16round');
|
||||
var path = require('../../internals/path');
|
||||
|
||||
module.exports = path.Math.f16round;
|
||||
@@ -7,6 +7,7 @@ require('../../modules/es.math.clz32');
|
||||
require('../../modules/es.math.cosh');
|
||||
require('../../modules/es.math.expm1');
|
||||
require('../../modules/es.math.fround');
|
||||
require('../../modules/es.math.f16round');
|
||||
require('../../modules/es.math.hypot');
|
||||
require('../../modules/es.math.imul');
|
||||
require('../../modules/es.math.log10');
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
var $ = require('../internals/export');
|
||||
var uncurryThis = require('../internals/function-uncurry-this');
|
||||
|
||||
var pow = Math.pow;
|
||||
|
||||
var EXP_MASK16 = 31; // 2 ** 5 - 1
|
||||
var SIGNIFICAND_MASK16 = 1023; // 2 ** 10 - 1
|
||||
var MIN_SUBNORMAL16 = pow(2, -24); // 2 ** -10 * 2 ** -14
|
||||
var SIGNIFICAND_DENOM16 = 0.0009765625; // 2 ** -10
|
||||
|
||||
var unpackFloat16 = function (bytes) {
|
||||
var sign = bytes >>> 15;
|
||||
var exponent = bytes >>> 10 & EXP_MASK16;
|
||||
var significand = bytes & SIGNIFICAND_MASK16;
|
||||
if (exponent === EXP_MASK16) return significand === 0 ? (sign === 0 ? Infinity : -Infinity) : NaN;
|
||||
if (exponent === 0) return significand * (sign === 0 ? MIN_SUBNORMAL16 : -MIN_SUBNORMAL16);
|
||||
return pow(2, exponent - 15) * (sign === 0 ? 1 + significand * SIGNIFICAND_DENOM16 : -1 - significand * SIGNIFICAND_DENOM16);
|
||||
};
|
||||
|
||||
// eslint-disable-next-line es/no-typed-arrays -- safe
|
||||
var getUint16 = uncurryThis(DataView.prototype.getUint16);
|
||||
|
||||
// `DataView.prototype.getFloat16` method
|
||||
// https://github.com/tc39/proposal-float16array
|
||||
$({ target: 'DataView', proto: true }, {
|
||||
getFloat16: function getFloat16(byteOffset /* , littleEndian */) {
|
||||
var uint16 = getUint16(this, byteOffset, arguments.length > 1 ? arguments[1] : false);
|
||||
return unpackFloat16(uint16);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,54 @@
|
||||
'use strict';
|
||||
var $ = require('../internals/export');
|
||||
var uncurryThis = require('../internals/function-uncurry-this');
|
||||
var aDataView = require('../internals/a-data-view');
|
||||
var toIndex = require('../internals/to-index');
|
||||
// TODO: Replace with module dependency in `core-js@4`
|
||||
var log2 = require('../internals/math-log2');
|
||||
var roundTiesToEven = require('../internals/math-round-ties-to-even');
|
||||
|
||||
var pow = Math.pow;
|
||||
|
||||
var MIN_INFINITY16 = 65520; // (2 - 2 ** -11) * 2 ** 15
|
||||
var MIN_NORMAL16 = 0.000061005353927612305; // (1 - 2 ** -11) * 2 ** -14
|
||||
var REC_MIN_SUBNORMAL16 = 16777216; // 2 ** 10 * 2 ** 14
|
||||
var REC_SIGNIFICAND_DENOM16 = 1024; // 2 ** 10;
|
||||
|
||||
var packFloat16 = function (value) {
|
||||
// eslint-disable-next-line no-self-compare -- NaN check
|
||||
if (value !== value) return 0x7E00; // NaN
|
||||
if (value === 0) return (1 / value === -Infinity) << 15; // +0 or -0
|
||||
|
||||
var neg = value < 0;
|
||||
if (neg) value = -value;
|
||||
if (value >= MIN_INFINITY16) return neg << 15 | 0x7C00; // Infinity
|
||||
if (value < MIN_NORMAL16) return neg << 15 | roundTiesToEven(value * REC_MIN_SUBNORMAL16); // subnormal
|
||||
|
||||
// normal
|
||||
var exponent = log2(value) | 0;
|
||||
if (exponent === -15) {
|
||||
// we round from a value between 2 ** -15 * (1 + 1022/1024) (the largest subnormal) and 2 ** -14 * (1 + 0/1024) (the smallest normal)
|
||||
// to the latter (former impossible because of the subnormal check above)
|
||||
return neg << 15 | REC_SIGNIFICAND_DENOM16;
|
||||
}
|
||||
var significand = roundTiesToEven((value * pow(2, -exponent) - 1) * REC_SIGNIFICAND_DENOM16);
|
||||
if (significand === REC_SIGNIFICAND_DENOM16) {
|
||||
// we round from a value between 2 ** n * (1 + 1023/1024) and 2 ** (n + 1) * (1 + 0/1024) to the latter
|
||||
return neg << 15 | exponent + 16 << 10;
|
||||
}
|
||||
return neg << 15 | exponent + 15 << 10 | significand;
|
||||
};
|
||||
|
||||
// eslint-disable-next-line es/no-typed-arrays -- safe
|
||||
var setUint16 = uncurryThis(DataView.prototype.setUint16);
|
||||
|
||||
// `DataView.prototype.setFloat16` method
|
||||
// https://github.com/tc39/proposal-float16array
|
||||
$({ target: 'DataView', proto: true }, {
|
||||
setFloat16: function setFloat16(byteOffset, value /* , littleEndian */) {
|
||||
aDataView(this);
|
||||
var offset = toIndex(byteOffset);
|
||||
var bytes = packFloat16(+value);
|
||||
return setUint16(this, offset, bytes, arguments.length > 2 ? arguments[2] : false);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
var $ = require('../internals/export');
|
||||
var floatRound = require('../internals/math-float-round');
|
||||
|
||||
var FLOAT16_EPSILON = 0.0009765625;
|
||||
var FLOAT16_MAX_VALUE = 65504;
|
||||
var FLOAT16_MIN_VALUE = 6.103515625e-05;
|
||||
|
||||
// `Math.f16round` method
|
||||
// https://github.com/tc39/proposal-float16array
|
||||
$({ target: 'Math', stat: true }, {
|
||||
f16round: function f16round(x) {
|
||||
return floatRound(x, FLOAT16_EPSILON, FLOAT16_MAX_VALUE, FLOAT16_MIN_VALUE);
|
||||
}
|
||||
});
|
||||
@@ -1,31 +1,3 @@
|
||||
'use strict';
|
||||
var $ = require('../internals/export');
|
||||
var uncurryThis = require('../internals/function-uncurry-this');
|
||||
|
||||
var pow = Math.pow;
|
||||
|
||||
var EXP_MASK16 = 31; // 2 ** 5 - 1
|
||||
var SIGNIFICAND_MASK16 = 1023; // 2 ** 10 - 1
|
||||
var MIN_SUBNORMAL16 = pow(2, -24); // 2 ** -10 * 2 ** -14
|
||||
var SIGNIFICAND_DENOM16 = 0.0009765625; // 2 ** -10
|
||||
|
||||
var unpackFloat16 = function (bytes) {
|
||||
var sign = bytes >>> 15;
|
||||
var exponent = bytes >>> 10 & EXP_MASK16;
|
||||
var significand = bytes & SIGNIFICAND_MASK16;
|
||||
if (exponent === EXP_MASK16) return significand === 0 ? (sign === 0 ? Infinity : -Infinity) : NaN;
|
||||
if (exponent === 0) return significand * (sign === 0 ? MIN_SUBNORMAL16 : -MIN_SUBNORMAL16);
|
||||
return pow(2, exponent - 15) * (sign === 0 ? 1 + significand * SIGNIFICAND_DENOM16 : -1 - significand * SIGNIFICAND_DENOM16);
|
||||
};
|
||||
|
||||
// eslint-disable-next-line es/no-typed-arrays -- safe
|
||||
var getUint16 = uncurryThis(DataView.prototype.getUint16);
|
||||
|
||||
// `DataView.prototype.getFloat16` method
|
||||
// https://github.com/tc39/proposal-float16array
|
||||
$({ target: 'DataView', proto: true }, {
|
||||
getFloat16: function getFloat16(byteOffset /* , littleEndian */) {
|
||||
var uint16 = getUint16(this, byteOffset, arguments.length > 1 ? arguments[1] : false);
|
||||
return unpackFloat16(uint16);
|
||||
}
|
||||
});
|
||||
// TODO: Remove from `core-js@4`
|
||||
require('../modules/es.data-view.get-float16');
|
||||
|
||||
@@ -1,54 +1,3 @@
|
||||
'use strict';
|
||||
var $ = require('../internals/export');
|
||||
var uncurryThis = require('../internals/function-uncurry-this');
|
||||
var aDataView = require('../internals/a-data-view');
|
||||
var toIndex = require('../internals/to-index');
|
||||
// TODO: Replace with module dependency in `core-js@4`
|
||||
var log2 = require('../internals/math-log2');
|
||||
var roundTiesToEven = require('../internals/math-round-ties-to-even');
|
||||
|
||||
var pow = Math.pow;
|
||||
|
||||
var MIN_INFINITY16 = 65520; // (2 - 2 ** -11) * 2 ** 15
|
||||
var MIN_NORMAL16 = 0.000061005353927612305; // (1 - 2 ** -11) * 2 ** -14
|
||||
var REC_MIN_SUBNORMAL16 = 16777216; // 2 ** 10 * 2 ** 14
|
||||
var REC_SIGNIFICAND_DENOM16 = 1024; // 2 ** 10;
|
||||
|
||||
var packFloat16 = function (value) {
|
||||
// eslint-disable-next-line no-self-compare -- NaN check
|
||||
if (value !== value) return 0x7E00; // NaN
|
||||
if (value === 0) return (1 / value === -Infinity) << 15; // +0 or -0
|
||||
|
||||
var neg = value < 0;
|
||||
if (neg) value = -value;
|
||||
if (value >= MIN_INFINITY16) return neg << 15 | 0x7C00; // Infinity
|
||||
if (value < MIN_NORMAL16) return neg << 15 | roundTiesToEven(value * REC_MIN_SUBNORMAL16); // subnormal
|
||||
|
||||
// normal
|
||||
var exponent = log2(value) | 0;
|
||||
if (exponent === -15) {
|
||||
// we round from a value between 2 ** -15 * (1 + 1022/1024) (the largest subnormal) and 2 ** -14 * (1 + 0/1024) (the smallest normal)
|
||||
// to the latter (former impossible because of the subnormal check above)
|
||||
return neg << 15 | REC_SIGNIFICAND_DENOM16;
|
||||
}
|
||||
var significand = roundTiesToEven((value * pow(2, -exponent) - 1) * REC_SIGNIFICAND_DENOM16);
|
||||
if (significand === REC_SIGNIFICAND_DENOM16) {
|
||||
// we round from a value between 2 ** n * (1 + 1023/1024) and 2 ** (n + 1) * (1 + 0/1024) to the latter
|
||||
return neg << 15 | exponent + 16 << 10;
|
||||
}
|
||||
return neg << 15 | exponent + 15 << 10 | significand;
|
||||
};
|
||||
|
||||
// eslint-disable-next-line es/no-typed-arrays -- safe
|
||||
var setUint16 = uncurryThis(DataView.prototype.setUint16);
|
||||
|
||||
// `DataView.prototype.setFloat16` method
|
||||
// https://github.com/tc39/proposal-float16array
|
||||
$({ target: 'DataView', proto: true }, {
|
||||
setFloat16: function setFloat16(byteOffset, value /* , littleEndian */) {
|
||||
aDataView(this);
|
||||
var offset = toIndex(byteOffset);
|
||||
var bytes = packFloat16(+value);
|
||||
return setUint16(this, offset, bytes, arguments.length > 2 ? arguments[2] : false);
|
||||
}
|
||||
});
|
||||
// TODO: Remove from `core-js@4`
|
||||
require('../modules/es.data-view.set-float16');
|
||||
|
||||
@@ -1,15 +1,3 @@
|
||||
'use strict';
|
||||
var $ = require('../internals/export');
|
||||
var floatRound = require('../internals/math-float-round');
|
||||
|
||||
var FLOAT16_EPSILON = 0.0009765625;
|
||||
var FLOAT16_MAX_VALUE = 65504;
|
||||
var FLOAT16_MIN_VALUE = 6.103515625e-05;
|
||||
|
||||
// `Math.f16round` method
|
||||
// https://github.com/tc39/proposal-float16array
|
||||
$({ target: 'Math', stat: true }, {
|
||||
f16round: function f16round(x) {
|
||||
return floatRound(x, FLOAT16_EPSILON, FLOAT16_MAX_VALUE, FLOAT16_MIN_VALUE);
|
||||
}
|
||||
});
|
||||
// TODO: Remove from `core-js@4`
|
||||
require('../modules/es.math.f16round');
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
var parent = require('../../es/data-view/get-float16');
|
||||
|
||||
module.exports = parent;
|
||||
@@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
var parent = require('../../es/data-view/set-float16');
|
||||
|
||||
module.exports = parent;
|
||||
@@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
var parent = require('../../es/math/f16round');
|
||||
|
||||
module.exports = parent;
|
||||
@@ -5,7 +5,6 @@ require('../proposals/array-buffer-base64');
|
||||
require('../proposals/array-from-async-stage-2');
|
||||
require('../proposals/decorator-metadata-v2');
|
||||
require('../proposals/explicit-resource-management');
|
||||
require('../proposals/float16');
|
||||
require('../proposals/is-error');
|
||||
require('../proposals/json-parse-with-source');
|
||||
require('../proposals/math-sum');
|
||||
|
||||
@@ -6,6 +6,7 @@ require('../proposals/array-find-from-last');
|
||||
require('../proposals/array-grouping-v2');
|
||||
require('../proposals/change-array-by-copy-stage-4');
|
||||
// require('../proposals/error-cause');
|
||||
require('../proposals/float16');
|
||||
require('../proposals/global-this');
|
||||
require('../proposals/iterator-helpers-stage-3-2');
|
||||
require('../proposals/promise-all-settled');
|
||||
|
||||
@@ -16,6 +16,7 @@ deepEqual(compat({
|
||||
'es.array.at',
|
||||
'es.math.clz32',
|
||||
'es.math.expm1',
|
||||
'es.math.f16round',
|
||||
'es.math.to-string-tag',
|
||||
'es.reflect.apply',
|
||||
'es.reflect.construct',
|
||||
@@ -35,6 +36,7 @@ deepEqual(compat({
|
||||
'es.array.at': { firefox: '27' },
|
||||
'es.math.clz32': { firefox: '27' },
|
||||
'es.math.expm1': { firefox: '27' },
|
||||
'es.math.f16round': { firefox: '27' },
|
||||
'es.math.to-string-tag': { firefox: '27' },
|
||||
'es.reflect.apply': { firefox: '27' },
|
||||
'es.reflect.construct': { firefox: '27' },
|
||||
@@ -107,6 +109,7 @@ deepEqual(compat({
|
||||
'es.math.acosh',
|
||||
'es.math.clz32',
|
||||
'es.math.expm1',
|
||||
'es.math.f16round',
|
||||
'es.math.hypot',
|
||||
'es.math.to-string-tag',
|
||||
],
|
||||
@@ -114,6 +117,7 @@ deepEqual(compat({
|
||||
'es.math.acosh': { chrome: '40' },
|
||||
'es.math.clz32': { firefox: '27' },
|
||||
'es.math.expm1': { firefox: '27' },
|
||||
'es.math.f16round': { chrome: '40', firefox: '27' },
|
||||
'es.math.hypot': { chrome: '40' },
|
||||
'es.math.to-string-tag': { chrome: '40', firefox: '27' },
|
||||
},
|
||||
|
||||
@@ -656,6 +656,12 @@ GLOBAL.tests = {
|
||||
return ArrayBuffer.prototype.transferToFixedLength;
|
||||
},
|
||||
'es.data-view.constructor': ARRAY_BUFFER_SUPPORT,
|
||||
'es.data-view.get-float16': [ARRAY_BUFFER_SUPPORT, function () {
|
||||
return DataView.prototype.getFloat16;
|
||||
}],
|
||||
'es.data-view.set-float16': [ARRAY_BUFFER_SUPPORT, function () {
|
||||
return DataView.prototype.setFloat16;
|
||||
}],
|
||||
'es.date.get-year': function () {
|
||||
return new Date(16e11).getYear() === 120;
|
||||
},
|
||||
@@ -815,6 +821,9 @@ GLOBAL.tests = {
|
||||
'es.math.fround': function () {
|
||||
return Math.fround;
|
||||
},
|
||||
'es.math.f16round': function () {
|
||||
return Math.f16round;
|
||||
},
|
||||
'es.math.hypot': function () {
|
||||
return Math.hypot && Math.hypot(Infinity, NaN) === Infinity;
|
||||
},
|
||||
@@ -1694,15 +1703,9 @@ GLOBAL.tests = {
|
||||
'esnext.composite-symbol': function () {
|
||||
return compositeSymbol;
|
||||
},
|
||||
'esnext.data-view.get-float16': [ARRAY_BUFFER_SUPPORT, function () {
|
||||
return DataView.prototype.getFloat16;
|
||||
}],
|
||||
'esnext.data-view.get-uint8-clamped': [ARRAY_BUFFER_SUPPORT, function () {
|
||||
return DataView.prototype.getUint8Clamped;
|
||||
}],
|
||||
'esnext.data-view.set-float16': [ARRAY_BUFFER_SUPPORT, function () {
|
||||
return DataView.prototype.setFloat16;
|
||||
}],
|
||||
'esnext.data-view.set-uint8-clamped': [ARRAY_BUFFER_SUPPORT, function () {
|
||||
return DataView.prototype.setUint8Clamped;
|
||||
}],
|
||||
@@ -1815,9 +1818,6 @@ GLOBAL.tests = {
|
||||
'esnext.math.fscale': function () {
|
||||
return Math.fscale;
|
||||
},
|
||||
'esnext.math.f16round': function () {
|
||||
return Math.f16round;
|
||||
},
|
||||
'esnext.math.rad-per-deg': function () {
|
||||
return Math.RAD_PER_DEG;
|
||||
},
|
||||
|
||||
@@ -146,6 +146,7 @@ for (PATH of ['core-js-pure', 'core-js']) {
|
||||
ok(load(NS, 'math/cosh')(0) === 1);
|
||||
ok(load(NS, 'math/expm1')(-Infinity) === -1);
|
||||
ok(load(NS, 'math/fround')(0) === 0);
|
||||
ok(load(NS, 'math/f16round')(1.337) === 1.3369140625);
|
||||
ok(load(NS, 'math/hypot')(3, 4) === 5);
|
||||
ok(load(NS, 'math/imul')(2, 2) === 4);
|
||||
ok(load(NS, 'math/log10')(-0) === -Infinity);
|
||||
@@ -696,15 +697,12 @@ for (PATH of ['core-js-pure', 'core-js']) {
|
||||
ok(typeof load(NS, 'async-iterator/some') == 'function');
|
||||
ok(typeof load(NS, 'async-iterator/take') == 'function');
|
||||
ok(typeof load(NS, 'async-iterator/to-array') == 'function');
|
||||
load(NS, 'data-view/get-float16');
|
||||
load(NS, 'data-view/set-float16');
|
||||
ok(load(NS, 'error/is-error')(new Error()));
|
||||
ok(load(NS, 'function/metadata') === null);
|
||||
ok(typeof load(NS, 'iterator/to-async') == 'function');
|
||||
ok(load(NS, 'json/is-raw-json')({}) === false);
|
||||
ok(load(NS, 'json/parse')('[42]', (key, value, { source }) => typeof value == 'number' ? source + source : value)[0] === '4242');
|
||||
ok(typeof load(NS, 'json/raw-json')(42) == 'object');
|
||||
ok(load(NS, 'math/f16round')(1.337) === 1.3369140625);
|
||||
ok(load(NS, 'math/sum-precise')([1, 2, 3]) === 6);
|
||||
ok(load(NS, 'symbol/dispose'));
|
||||
ok(load(NS, 'symbol/metadata'));
|
||||
@@ -1033,6 +1031,8 @@ for (const NS of ['es', 'stable', 'actual', 'full', 'features']) {
|
||||
load(NS, 'array-buffer/transfer');
|
||||
load(NS, 'array-buffer/transfer-to-fixed-length');
|
||||
ok(typeof load(NS, 'data-view') == 'function');
|
||||
load(NS, 'data-view/get-float16');
|
||||
load(NS, 'data-view/set-float16');
|
||||
ok(typeof load(NS, 'typed-array/int8-array') == 'function');
|
||||
ok(typeof load(NS, 'typed-array/uint8-array') == 'function');
|
||||
ok(typeof load(NS, 'typed-array/uint8-clamped-array') == 'function');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// some asserts based on https://github.com/petamoriken/float16/blob/master/test/f16round.js
|
||||
import { createConversionChecker } from '../helpers/helpers.js';
|
||||
|
||||
import f16round from 'core-js-pure/actual/math/f16round';
|
||||
import f16round from 'core-js-pure/es/math/f16round';
|
||||
|
||||
const { MAX_VALUE, MIN_VALUE } = Number;
|
||||
|
||||
Reference in New Issue
Block a user