-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Avoid division-by-zero in Sketch::Sketch #28707
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
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.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join us on gitter for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
src/path_converters.h
Outdated
// Set derived values to zero if m_length or m_randomness are zero to | ||
// avoid divide-by-zero errors when a sketch is created but not used. |
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.
// Set derived values to zero if m_length or m_randomness are zero to | |
// avoid divide-by-zero errors when a sketch is created but not used. | |
// Set derived values to zero if m_length or m_randomness are zero to | |
// avoid divide-by-zero errors when a sketch is created but not used. |
Don't think c++ code actually cares, but can we stick with spaces rather than tabs?
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.
Oops, sorry -- thought I'd picked these up. Fixed.
The doc failure looks unrelated to me (and I would be is happening on main as well). |
Thank you @jsspencer and congratulations on your first merged PR to Matplotlib 🎉 I hope we hear from you again! |
PR summary
An optimization introduced in #24964 introduced a divide-by-zero error when creating a
Sketch
object in cases where some parameters were set to 0. This is normally fine as the sketch is not used in these cases and was only detectable when compiled with-fsanitize=float-divide-by-zero
. Avoid these errors by detecting zero and near-zero values passed in and set derived values to 0 in these cases.closes #28669
PR checklist