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

Catch division by zero in SecantMethod #56

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

haakon-e
Copy link
Member

@haakon-e haakon-e commented Dec 19, 2024

In some (likely rare) instances, especially working with Float32, it's possible to get the same value y=f(x) for two successive x0, x1. In this case, a division-by-zero would occur, resulting in garbage output despite the possibility of already having converged.

This PR catches this edge case, and returns the current state. The method will be declared converged if abs(x1-x0) is small, otherwise it will be declared not converged (but still return).

@haakon-e haakon-e changed the title He/root-errors Catch division by zero in SecantMethod Dec 19, 2024
@haakon-e haakon-e linked an issue Dec 19, 2024 that may be closed by this pull request
@haakon-e haakon-e added the Launch Buildkite Add to launch buildkite run label Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Launch Buildkite Add to launch buildkite run
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Root division by zero edge case
1 participant