Skip to content

Eliminate warning from division by zero#51

Merged
hurricane642 merged 2 commits intomainfrom
warning_elim
Nov 4, 2023
Merged

Eliminate warning from division by zero#51
hurricane642 merged 2 commits intomainfrom
warning_elim

Conversation

@hurricane642
Copy link
Copy Markdown
Collaborator

@hurricane642 hurricane642 commented Nov 4, 2023

In this PR, we eliminate a possible warning caused by division by zero. Previously, we only handled the ZeroDivisionError error, but when we vectorize the function, numpy returns Warning instead of this error, so this case was not handled at all. Now we have set up a rather simple if, which checks the value of the number we plan to divide by. If it is less than 1e-20, we just return inf.
Thanks to @pinkston3 for catching this problem!

@hurricane642 hurricane642 added the invalid This doesn't seem right label Nov 4, 2023
@hurricane642 hurricane642 self-assigned this Nov 4, 2023
@hurricane642 hurricane642 merged commit 0262543 into main Nov 4, 2023
@hurricane642 hurricane642 deleted the warning_elim branch November 4, 2023 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

invalid This doesn't seem right

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant