You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
662 B

2 weeks ago
'use strict';
var $ = require('../internals/export');
var uncurryThis = require('../internals/function-uncurry-this');
var unpackIEEE754 = require('../internals/ieee754').unpack;
// 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 unpackIEEE754([uint16 & 0xFF, uint16 >> 8 & 0xFF], 10);
}
});