@webassemblyjs/floating-point-hex-parser
A function to parse floating point hexadecimal strings as defined by the WebAssembly specification
Last updated 6 years ago by xtuc .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install @webassemblyjs/floating-point-hex-parser 
SYNC missed versions from official npm registry.

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.

Links

Current Tags

  • 1.11.6                                ...           latest (2 years ago)

65 Versions

  • 1.11.6                                ...           2 years ago
  • 1.11.5                                ...           2 years ago
  • 1.11.4                                ...           2 years ago
  • 1.11.1                                ...           3 years ago
  • 1.11.0                                ...           4 years ago
  • 1.10.1                                ...           4 years ago
  • 1.10.0                                ...           4 years ago
  • 1.9.1                                ...           4 years ago
  • 1.9.0                                ...           5 years ago
  • 1.8.5                                ...           6 years ago
  • 1.8.4                                ...           6 years ago
  • 1.8.3                                ...           6 years ago
  • 1.8.2                                ...           6 years ago
  • 1.8.1                                ...           6 years ago
  • 1.8.0                                ...           6 years ago
  • 1.7.11                                ...           6 years ago
  • 1.7.10                                ...           6 years ago
  • 1.7.9                                ...           6 years ago
  • 1.7.8                                ...           6 years ago
  • 1.7.7                                ...           6 years ago
  • 1.7.6                                ...           6 years ago
  • 1.7.5                                ...           6 years ago
  • 1.7.4                                ...           6 years ago
  • 1.7.3                                ...           6 years ago
  • 1.7.2                                ...           6 years ago
  • 1.7.2-1                                ...           6 years ago
  • 1.7.2-0                                ...           6 years ago
  • 1.7.1                                ...           6 years ago
  • 1.7.0                                ...           6 years ago
  • 1.7.0-3                                ...           6 years ago
  • 1.7.0-2                                ...           6 years ago
  • 1.7.0-1                                ...           6 years ago
  • 1.6.1                                ...           6 years ago
  • 1.7.1-0                                ...           6 years ago
  • 1.7.0-0                                ...           6 years ago
  • 1.6.0                                ...           6 years ago
  • 1.5.13                                ...           6 years ago
  • 1.5.12                                ...           7 years ago
  • 1.5.11                                ...           7 years ago
  • 1.5.10                                ...           7 years ago
  • 1.5.9                                ...           7 years ago
  • 1.5.8                                ...           7 years ago
  • 1.5.7                                ...           7 years ago
  • 1.5.6                                ...           7 years ago
  • 1.5.5                                ...           7 years ago
  • 1.5.4                                ...           7 years ago
  • 1.5.3                                ...           7 years ago
  • 1.5.2                                ...           7 years ago
  • 1.5.1                                ...           7 years ago
  • 1.5.0                                ...           7 years ago
  • 1.4.3                                ...           7 years ago
  • 1.4.2                                ...           7 years ago
  • 1.4.1                                ...           7 years ago
  • 1.4.0                                ...           7 years ago
  • 1.3.3                                ...           7 years ago
  • 1.3.2                                ...           7 years ago
  • 1.3.1                                ...           7 years ago
  • 1.3.0                                ...           7 years ago
  • 1.2.8                                ...           7 years ago
  • 1.2.7                                ...           7 years ago
  • 1.2.6                                ...           7 years ago
  • 1.2.5                                ...           7 years ago
  • 1.2.4                                ...           7 years ago
  • 1.2.3                                ...           7 years ago
  • 1.2.2                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (0)
None

Copyright 2013 - present © cnpmjs.org | Home |