holoviz / spatialpandas

Pandas extension arrays for spatial/geometric operations
BSD 2-Clause "Simplified" License
308 stars 25 forks source link

Update resolution for floats in tests #157

Closed hoxbro closed 3 weeks ago

hoxbro commented 3 weeks ago

Fixes https://github.com/holoviz/spatialpandas/issues/152

The original example came down to this:

ax0 = 1.0
ay0 = -16.0
ax1 = 0.0
ay1 = 0.0

bx0 = 0.0
by0 = -1e-15
bx1 = 0.0
by1 = -1.0

triangle_orientation(ax0, -16.0, ax1, ay1, bx0, by0), triangle_orientation(ax0, -17.0, ax1, ay1, bx0, by0)  #Returns True, False

Which could further be reduced to this precision problem: image

Now, we round the floats to one above the computer precision of numpy floats (for me, 15).

codecov[bot] commented 3 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 77.47%. Comparing base (81c841a) to head (31f2fa4). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #157 +/- ## ======================================= Coverage 77.46% 77.47% ======================================= Files 50 50 Lines 4842 4843 +1 ======================================= + Hits 3751 3752 +1 Misses 1091 1091 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.