Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Floating point precision issues when searching for exact points #33

Open
Smilliam opened this issue Jan 29, 2018 · 0 comments
Open

Floating point precision issues when searching for exact points #33

Smilliam opened this issue Jan 29, 2018 · 0 comments

Comments

@Smilliam
Copy link

Smilliam commented Jan 29, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant