Closed cconvey closed 1 day ago
When debugging this, it might help to enable signalling-NaNs in the floating-point environment.
I've narrowed the (proximate?) root cause to this line: https://github.com/campreilly/UnderSeaModelingLibrary/blob/d4e140920e2be5cbd068c60c2a8e68bcf082891d/waveq3d/test/refraction_test.cc#L748
When s
takes on a value slightly below 1.0 (0.99999999999999988898
), then in the following line:
https://github.com/campreilly/UnderSeaModelingLibrary/blob/d4e140920e2be5cbd068c60c2a8e68bcf082891d/waveq3d/test/refraction_test.cc#L749
acosh(sqrt(s))
returns NaN
, which then propagates through the rest of the math.
The error goes away when I clamp the lower-bound of s
:
double s = max<double>(1.0, -0.5 * ((sinT2 * cos(t) - 1.0) / cosT2 - 1.0);
@campreilly : I'm not really qualified to decide if this is an appropriate fix, so I'll leave the rest up to you.
This is an appropriate fix. You can make the fix if you'd like. Otherwise, I'll handle it in the next update.
Sounds good. I'll try to have a PR in the next few days, but it's cool if you beat me to it.
Some builds of USML consistently cause
usml_test
to report this error:Build configurations that always trigger this error:
Build configurations that never trigger this error:
(These are the only build configurations I checked.)