Big update!Announcing Socket for GitHub 1.0. Learn more
Socket
BlogLoveFAQ
Install
Log in

@webassemblyjs/floating-point-hex-parser

Package Overview
Dependencies
0
Maintainers
1
Versions
63
Issues
File Explorer

Advanced tools

@webassemblyjs/floating-point-hex-parser

A function to parse floating point hexadecimal strings as defined by the WebAssembly specification

    1.11.4latest

Version published
Maintainers
1
Weekly downloads
18,222,942
decreased by-4.2%

Weekly downloads

Readme

Source

Parser function for floating point hexadecimals

license GitHub last commit npm

A JavaScript function to parse floating point hexadecimals as defined by the WebAssembly specification.

Usage

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. The second one is non-deterministic (sometimes called fuzzing):

  1. Generate a random IEEE754 double precision value x.
  2. Compute its representation y in floating point hexadecimal format using the C standard library function printf since C supports this format.
  3. 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.

Keywords

FAQs

What is @webassemblyjs/floating-point-hex-parser?

A function to parse floating point hexadecimal strings as defined by the WebAssembly specification

Is @webassemblyjs/floating-point-hex-parser popular?

The npm package @webassemblyjs/floating-point-hex-parser receives a total of 14,573,841 weekly downloads. As such, @webassemblyjs/floating-point-hex-parser popularity was classified as popular.

Is @webassemblyjs/floating-point-hex-parser well maintained?

We found that @webassemblyjs/floating-point-hex-parser demonstrated a healthy version release cadence and project activity. It has 1 open source maintainer collaborating on the project.

Last updated on 02 Jul 2022
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc