Adjust European short trip heuristic from >3 days to >1 day to correctly detect when user has returned home from European trips. This fixes the April 29-30, 2023 case where the location incorrectly showed "Sankt Georg, Hamburg" instead of "Bristol" when the user was free (no events scheduled) after the foss-north trip ended on April 27. The previous logic required more than 3 days to pass before assuming return home from European countries, but for short European trips by rail/ferry, users typically return within 1-2 days. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
---|---|---|
.. | ||
lib | ||
LICENSE | ||
package.json | ||
README.md |
Parser function for floating point hexadecimals
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):
- Generate a random IEEE754 double precision value
x
. - Compute its representation
y
in floating point hexadecimal format using the C standard library functionprintf
since 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.