diff options
Diffstat (limited to 'node_modules/@webassemblyjs/floating-point-hex-parser')
5 files changed, 0 insertions, 202 deletions
diff --git a/node_modules/@webassemblyjs/floating-point-hex-parser/LICENSE b/node_modules/@webassemblyjs/floating-point-hex-parser/LICENSE deleted file mode 100644 index d5471f8..0000000 --- a/node_modules/@webassemblyjs/floating-point-hex-parser/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License
-
-Copyright (c) 2017 Mauro Bringolf
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
\ No newline at end of file diff --git a/node_modules/@webassemblyjs/floating-point-hex-parser/README.md b/node_modules/@webassemblyjs/floating-point-hex-parser/README.md deleted file mode 100644 index 648e09b..0000000 --- a/node_modules/@webassemblyjs/floating-point-hex-parser/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# Parser function for floating point hexadecimals - -[]() -[]() -[]() - -> A JavaScript function to parse floating point hexadecimals as defined by the [WebAssembly specification](https://webassembly.github.io/spec/core/text/values.html#text-hexfloat). - -## Usage - -```javascript -import parseHexFloat from '@webassemblyjs/floating-point-hex-parser' - -parseHexFloat('0x1p-1') // 0.5 -parseHexFloat('0x1.921fb54442d18p+2') // 6.283185307179586 -``` - -## Tests - -This module is tested in two ways. The first one is through a small set of test cases that can be found in [test/regular.test.js](https://github.com/maurobringolf/@webassemblyjs/floating-point-hex-parser/blob/master/test/regular.test.js). The second one is non-deterministic (sometimes called *fuzzing*): - -1. Generate a random IEEE754 double precision value `x`. -1. Compute its representation `y` in floating point hexadecimal format using the C standard library function `printf` since C supports this format. -1. Give both values to JS testcase and see if `parseHexFloat(y) === x`. - -By default one `npm test` run tests 100 random samples. If you want to do more, you can set the environment variable `FUZZ_AMOUNT` to whatever number of runs you'd like. Because it uses one child process for each sample, it is really slow though. For more details about the randomized tests see [the source](https://github.com/maurobringolf/@webassemblyjs/floating-point-hex-parser/tree/master/test/fuzzing). - -## Links - -* [maurobringolf.ch/2017/12/hexadecimal-floating-point-notation/](https://maurobringolf.ch/2017/12/hexadecimal-floating-point-notation/) - -* [github.com/xtuc/js-webassembly-interpreter/issues/32](https://github.com/xtuc/js-webassembly-interpreter/issues/32) - -* [github.com/WebAssembly/design/issues/292](https://github.com/WebAssembly/design/issues/292) diff --git a/node_modules/@webassemblyjs/floating-point-hex-parser/esm/index.js b/node_modules/@webassemblyjs/floating-point-hex-parser/esm/index.js deleted file mode 100644 index d8d858d..0000000 --- a/node_modules/@webassemblyjs/floating-point-hex-parser/esm/index.js +++ /dev/null @@ -1,42 +0,0 @@ -export default function parse(input) { - input = input.toUpperCase(); - var splitIndex = input.indexOf("P"); - var mantissa, exponent; - - if (splitIndex !== -1) { - mantissa = input.substring(0, splitIndex); - exponent = parseInt(input.substring(splitIndex + 1)); - } else { - mantissa = input; - exponent = 0; - } - - var dotIndex = mantissa.indexOf("."); - - if (dotIndex !== -1) { - var integerPart = parseInt(mantissa.substring(0, dotIndex), 16); - var sign = Math.sign(integerPart); - integerPart = sign * integerPart; - var fractionLength = mantissa.length - dotIndex - 1; - var fractionalPart = parseInt(mantissa.substring(dotIndex + 1), 16); - var fraction = fractionLength > 0 ? fractionalPart / Math.pow(16, fractionLength) : 0; - - if (sign === 0) { - if (fraction === 0) { - mantissa = sign; - } else { - if (Object.is(sign, -0)) { - mantissa = -fraction; - } else { - mantissa = fraction; - } - } - } else { - mantissa = sign * (integerPart + fraction); - } - } else { - mantissa = parseInt(mantissa, 16); - } - - return mantissa * (splitIndex !== -1 ? Math.pow(2, exponent) : 1); -}
\ No newline at end of file diff --git a/node_modules/@webassemblyjs/floating-point-hex-parser/lib/index.js b/node_modules/@webassemblyjs/floating-point-hex-parser/lib/index.js deleted file mode 100644 index a867699..0000000 --- a/node_modules/@webassemblyjs/floating-point-hex-parser/lib/index.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = parse; - -function parse(input) { - input = input.toUpperCase(); - var splitIndex = input.indexOf("P"); - var mantissa, exponent; - - if (splitIndex !== -1) { - mantissa = input.substring(0, splitIndex); - exponent = parseInt(input.substring(splitIndex + 1)); - } else { - mantissa = input; - exponent = 0; - } - - var dotIndex = mantissa.indexOf("."); - - if (dotIndex !== -1) { - var integerPart = parseInt(mantissa.substring(0, dotIndex), 16); - var sign = Math.sign(integerPart); - integerPart = sign * integerPart; - var fractionLength = mantissa.length - dotIndex - 1; - var fractionalPart = parseInt(mantissa.substring(dotIndex + 1), 16); - var fraction = fractionLength > 0 ? fractionalPart / Math.pow(16, fractionLength) : 0; - - if (sign === 0) { - if (fraction === 0) { - mantissa = sign; - } else { - if (Object.is(sign, -0)) { - mantissa = -fraction; - } else { - mantissa = fraction; - } - } - } else { - mantissa = sign * (integerPart + fraction); - } - } else { - mantissa = parseInt(mantissa, 16); - } - - return mantissa * (splitIndex !== -1 ? Math.pow(2, exponent) : 1); -}
\ No newline at end of file diff --git a/node_modules/@webassemblyjs/floating-point-hex-parser/package.json b/node_modules/@webassemblyjs/floating-point-hex-parser/package.json deleted file mode 100644 index 424abcd..0000000 --- a/node_modules/@webassemblyjs/floating-point-hex-parser/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "_from": "@webassemblyjs/floating-point-hex-parser@1.9.0", - "_id": "@webassemblyjs/floating-point-hex-parser@1.9.0", - "_inBundle": false, - "_integrity": "sha512-TG5qcFsS8QB4g4MhrxK5TqfdNe7Ey/7YL/xN+36rRjl/BlGE/NcBvJcqsRgCP6Z92mRE+7N50pRIi8SmKUbcQA==", - "_location": "/@webassemblyjs/floating-point-hex-parser", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "@webassemblyjs/floating-point-hex-parser@1.9.0", - "name": "@webassemblyjs/floating-point-hex-parser", - "escapedName": "@webassemblyjs%2ffloating-point-hex-parser", - "scope": "@webassemblyjs", - "rawSpec": "1.9.0", - "saveSpec": null, - "fetchSpec": "1.9.0" - }, - "_requiredBy": [ - "/@webassemblyjs/wast-parser" - ], - "_resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.9.0.tgz", - "_shasum": "3c3d3b271bddfc84deb00f71344438311d52ffb4", - "_spec": "@webassemblyjs/floating-point-hex-parser@1.9.0", - "_where": "/home/pruss/Dev/3-minute-website/node_modules/@webassemblyjs/wast-parser", - "author": { - "name": "Mauro Bringolf" - }, - "bugs": { - "url": "https://github.com/xtuc/webassemblyjs/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "A function to parse floating point hexadecimal strings as defined by the WebAssembly specification", - "gitHead": "0440b420888c1f7701eb9762ec657775506b87d8", - "homepage": "https://github.com/xtuc/webassemblyjs#readme", - "keywords": [ - "webassembly", - "floating-point" - ], - "license": "MIT", - "main": "lib/index.js", - "module": "esm/index.js", - "name": "@webassemblyjs/floating-point-hex-parser", - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/xtuc/webassemblyjs.git" - }, - "scripts": { - "build-fuzzer": "[ -f ./test/fuzzing/parse.out ] || gcc ./test/fuzzing/parse.c -o ./test/fuzzing/parse.out -lm -Wall" - }, - "version": "1.9.0" -} |