Skip to content
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

Division by 0 in UpdateTransformCache #229

Closed
Lectem opened this issue May 17, 2021 · 2 comments
Closed

Division by 0 in UpdateTransformCache #229

Lectem opened this issue May 17, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@Lectem
Copy link

Lectem commented May 17, 2021

In the case where the minimum for an axis is 0, it causes a division by 0 here (and for Y axes):

gp.LogDenX = ImLog10(gp.CurrentPlot->XAxis.Range.Max / gp.CurrentPlot->XAxis.Range.Min);

This can be an issue when float exceptions are enabled.
I fixed this by arbitrarily setting LogDenX to 0 if the min value is 0, however I am unsure if you would want to fix it another way.
Note that it also causes issues if the Max/Min value is negative.

@epezent epezent added the bug Something isn't working label Jun 3, 2021
@epezent
Copy link
Owner

epezent commented Jun 9, 2021

This shouldn't matter since we always constrain the min value to be above 0 when log scale is enabled before UpdateTransformCache is ever called. However, we always calculate LogDen even if log scale is not enable, which is why you are seeing the exception. I've added a conditional that will skip the calculation of log scale is not enabled:

e9469cf

@epezent epezent closed this as completed Jun 9, 2021
@Lectem
Copy link
Author

Lectem commented Jun 11, 2021

It's less about the fact it could be incorrect and more about having to wrap code with disabled float exceptions :)

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants