@petamoriken/float16
Advanced tools
Comparing version 3.6.5 to 3.6.6
@@ -1,2 +0,2 @@ | ||
/*! @petamoriken/float16 v3.6.5 | MIT License - https://github.com/petamoriken/float16 */ | ||
/*! @petamoriken/float16 v3.6.6 | MIT License - https://github.com/petamoriken/float16 */ | ||
@@ -20,4 +20,2 @@ const float16 = (function (exports) { | ||
"Cannot convert undefined or null to object"; | ||
const CANNOT_CONVERT_A_BIGINT_VALUE_TO_A_NUMBER = | ||
"Cannot convert a BigInt value to a number"; | ||
const CANNOT_MIX_BIGINT_AND_OTHER_TYPES = | ||
@@ -56,7 +54,7 @@ "Cannot mix BigInt and other types, use explicit conversions"; | ||
const NativeProxy = Proxy; | ||
const NativeNumber = Number; | ||
const { | ||
MAX_SAFE_INTEGER: MAX_SAFE_INTEGER, | ||
isFinite: NumberIsFinite, | ||
isNaN: NumberIsNaN, | ||
} = NativeNumber; | ||
} = Number; | ||
const { | ||
@@ -288,3 +286,3 @@ iterator: SymbolIterator, | ||
} | ||
const number = NativeNumber(value); | ||
const number = +value; | ||
if (value !== number + "") { | ||
@@ -395,8 +393,4 @@ return false; | ||
const MAX_SAFE_INTEGER = NativeNumber.MAX_SAFE_INTEGER; | ||
function ToIntegerOrInfinity(target) { | ||
if (typeof target === "bigint") { | ||
throw NativeTypeError(CANNOT_CONVERT_A_BIGINT_VALUE_TO_A_NUMBER); | ||
} | ||
const number = NativeNumber(target); | ||
const number = +target; | ||
if (NumberIsNaN(number) || number === 0) { | ||
@@ -1232,11 +1226,8 @@ return 0; | ||
function hfround(num) { | ||
if (typeof num === "bigint") { | ||
throw NativeTypeError(CANNOT_CONVERT_A_BIGINT_VALUE_TO_A_NUMBER); | ||
function hfround(x) { | ||
const number = +x; | ||
if (!NumberIsFinite(number) || number === 0) { | ||
return number; | ||
} | ||
num = NativeNumber(num); | ||
if (!NumberIsFinite(num) || num === 0) { | ||
return num; | ||
} | ||
const x16 = roundToFloat16Bits(num); | ||
const x16 = roundToFloat16Bits(number); | ||
return convertToNumber(x16); | ||
@@ -1243,0 +1234,0 @@ } |
{ | ||
"name": "@petamoriken/float16", | ||
"version": "3.6.5", | ||
"version": "3.6.6", | ||
"description": "IEEE 754 half-precision floating-point for JavaScript", | ||
@@ -75,10 +75,10 @@ "keywords": [ | ||
"devDependencies": { | ||
"@babel/cli": "^7.17.10", | ||
"@babel/core": "^7.18.5", | ||
"@babel/plugin-transform-modules-commonjs": "^7.18.2", | ||
"@babel/cli": "^7.18.9", | ||
"@babel/core": "^7.18.9", | ||
"@babel/plugin-transform-modules-commonjs": "^7.18.6", | ||
"@types/nightwatch": "^2.0.9", | ||
"babel-plugin-replace-import-extension": "^1.1.3", | ||
"browserslist": "^4.21.0", | ||
"concurrently": "^7.2.2", | ||
"eslint": "^8.18.0", | ||
"browserslist": "^4.21.2", | ||
"concurrently": "^7.3.0", | ||
"eslint": "^8.20.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
@@ -92,7 +92,7 @@ "eslint-plugin-jsdoc": "^39.3.3", | ||
"mocha": "^10.0.0", | ||
"nightwatch": "^2.2.1", | ||
"nightwatch": "^2.2.3", | ||
"nightwatch-saucelabs-endsauce": "^1.2.1", | ||
"nyc": "^15.1.0", | ||
"power-assert": "^1.4.2", | ||
"rollup": "^2.75.7", | ||
"rollup": "^2.77.0", | ||
"rollup-plugin-cleanup": "^3.2.1", | ||
@@ -99,0 +99,0 @@ "source-map-support": "^0.5.21" |
@@ -41,2 +41,4 @@ # <a href="https://github.com/petamoriken/float16">float16</a> | ||
### Node.js | ||
```console | ||
@@ -50,5 +52,11 @@ npm install @petamoriken/float16 | ||
### Bun | ||
```console | ||
bun add @petamoriken/float16 | ||
``` | ||
## Import | ||
### Node.js or Bundler (webpack, rollup.js, esbuild, etc) | ||
### Node.js, Bun or Bundler (webpack, rollup.js, esbuild, etc) | ||
@@ -55,0 +63,0 @@ ```js |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
439
223798
5808