Skip to content

Fix incorrect multiplication #7

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Xendergo
Copy link

@Xendergo Xendergo commented Aug 9, 2025

Closes #6

The issue is that the early returns in select_root can return early for an incorrect root. The multiplication operation leads to the polynomial 1-4x-64x²-64x³-64x³+256x⁴ which has roots at -0.25 and 0.0954.., the second of which is the correct answer. While shrinking the intervals, the lower bound landed on -0.25, which is a root, triggering the early return.

image

This PR fixes the logic in select_root which should prevent this problem from occurring for all of the operations, not just multiplication.

@Xendergo Xendergo marked this pull request as ready for review August 10, 2025 13:23
@Xendergo Xendergo marked this pull request as draft August 10, 2025 22:30
@programmerjake
Copy link
Owner

thanks for finding the issue, I can merge this if you're ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect result of multiplication
2 participants