Open
Description
Hi there, so I've run into an issue with floating point precision when searching for exact points in an rtree. For a demonstration of this bug, grab my test case located on my fork here and run it a few times on the current build. You'll get some output similar to this:
$ node searchexact.test.js
TAP version 13
# RTree Searching for exact point
not ok 1 1k In-Bounds Searches
---
operator: equal
expected: 1000
actual: 997
at: Test.<anonymous> (/home/centos/proj/rtree/RTree/test/searchexact.test.js:23:5)
...
1..1
# tests 1
# pass 0
# fail 1
$ node searchexact.test.js
TAP version 13
# RTree Searching for exact point
not ok 1 1k In-Bounds Searches
---
operator: equal
expected: 1000
actual: 997
at: Test.<anonymous> (/home/centos/proj/rtree/RTree/test/searchexact.test.js:23:5)
...
1..1
# tests 1
# pass 0
# fail 1
$ node searchexact.test.js
TAP version 13
# RTree Searching for exact point
not ok 1 1k In-Bounds Searches
---
operator: equal
expected: 1000
actual: 998
at: Test.<anonymous> (/home/centos/proj/rtree/RTree/test/searchexact.test.js:23:5)
...
1..1
# tests 1
# pass 0
# fail 1
I've created a patch and submitted a PR (#34) for review. My solution was to introduce an epsilon and to check bounds relative to this epsilon.
Metadata
Metadata
Assignees
Labels
No labels