-
Notifications
You must be signed in to change notification settings - Fork 191
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
Fix FPEs in tests #6265
Fix FPEs in tests #6265
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for going through all these. I agree we can deal with the MC problems later.
T c(std::numeric_limits<T>::signaling_NaN()); | ||
T d(std::numeric_limits<T>::signaling_NaN()); | ||
// T c(std::numeric_limits<T>::quiet_NaN()); | ||
// T d(std::numeric_limits<T>::quiet_NaN()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove.
@@ -350,13 +351,21 @@ bool FixConservatives::operator()( | |||
: static_cast<SimdType>(0); | |||
|
|||
// Equation B.27 of Foucart | |||
// | |||
// We avoid division by zero in the SIMD case using a mask and effectively | |||
// set the result to zero by dividing by the max double. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you decided on a different implementation than this, without the max double part.
src/Time/ChooseLtsStepSize.cpp
Outdated
@@ -22,7 +22,10 @@ TimeDelta choose_lts_step_size(const Time& time, const double desired_step) { | |||
// n because of floating-point truncation. The inner ceil call | |||
// avoids this problem. | |||
const auto desired_step_power = | |||
static_cast<size_t>(std::ceil(std::log2(std::ceil(desired_step_count)))); | |||
desired_step == std::numeric_limits<double>::infinity() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs an abs()
, since the step can be negative, or check for desired_step_count == 0.0
instead.
We should check for negative numbers before trying a c2p. This is also more efficient.
We need to get FPEs in tests enabled again so we can actually resolve these things before they get merged. I think getting these FPEs fixed will actually take some effort and the code isn't used right now anyway.
I don't know if this is the intended test, but it at least resolves the FPE. I also don't know why the quiet NaN causes an FPE on comparison or if the quiet NaN somehow gets changed to a signaling one in the middle.
b00343e
to
bb24907
Compare
I made the changes. Since they are pretty small I just went ahead and squashed it. Partly to get this in before more FPEs appear 🙃 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I would have requested a direct squash if I'd thought of it.
Proposed changes
There are a couple MC neutrino tests I commented out because they're too hard for me to fix. That code isn't currently being used in simulations and will need a lot more debugging and testing in general. I'll talk with Francois Foucart about getting that fixed separately. My main goal is to just get FPEs on again in tests.
Upgrade instructions
Code review checklist
make doc
to generate the documentation locally intoBUILD_DIR/docs/html
.Then open
index.html
.code review guide.
bugfix
ornew feature
if appropriate.Further comments