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 errors #515
Comments
I'm not actually seeing fe errors when mimicking these tests... template<>
template<>
void object::test<5> ()
{
runTest(
"LINESTRING (0 0, 100 0, 10 100, 10 100)",
"LINESTRING (0 100, 0 10, 80 10)", 0.001, 47.89);
// check for floating point overflow exceptions
int raised = fetestexcept(FE_OVERFLOW);
ensure_equals(raised & FE_OVERFLOW, 0);
} |
Thanks for looking into this issue. Sorry I didn’t provide a reproducing code snippet, I am not so comfortable writing in C++. Looking at your example, I think you might reproduce the issue if you check for |
Yes, it's FE_INVALID, but I cannot track down where it is being set. |
Even when I track it down, the placement helps not at all. Somehow this is an overflow?
|
This ate my afternoon, and while I learned some fun things about architectures and debuggers, I'm no closer to eliminating these soft signals. You're just going to have to suppress/ignore them on your end. Make sure you're not turning on signals at some point in your code! |
Thanks for investigating this. It is certainly possible to hide these errors from the user in pygeos. I was mostly afraid something undefined was happening under the hood but now that you traced the origin it seems all right. This |
Not any of the coordinates being accessed. The z ordinate would have a NaN (since the input is 2d) but it's not read. |
Were you able to narrow down the floating point operation that resulted in the FE_INVALID? |
Yeah, but it also doesn't make any sense. It said the problem was this division. Again, the inputs were perfectly normal doubles, no nans or anything. https://github.com/libgeos/geos/blob/main/src/algorithm/distance/DiscreteHausdorffDistance.cpp#L88 |
Thanks again for diving into this! |
If you can track down any specific locations or changes, I'm happy to apply, just not having any luck on this snipe hunt thus far. |
In #485 a large amount of floating point errors were solved. However there are some that remained. I listed the ones that popped up in pygeos (with GEOS 3.10.1):
All through the CAPI. See pygeos pygeos/pygeos#441 for the specific tests where I encountered the FP “invalid” flags.
The text was updated successfully, but these errors were encountered: