Parser function for floating point hexadecimals
// 0.5// 6.283185307179586
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):
- Generate a random IEEE754 double precision value
- Compute its representation
yin floating point hexadecimal format using the C standard library function
printfsince C supports this format.
- 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.