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

Square root accuracy is ignored #97

Open
lipchev opened this issue Dec 22, 2024 · 0 comments · May be fixed by #98
Open

Square root accuracy is ignored #97

lipchev opened this issue Dec 22, 2024 · 0 comments · May be fixed by #98

Comments

@lipchev
Copy link
Contributor

lipchev commented Dec 22, 2024

This really came as a surprise to me, I've examined this function a number of times before and failed to spot the glaring issue (which was there ever since the function was first introduced in #13)..

        Fraction newGuess;
        do {
            //Babylonian Method
            newGuess = (oldGuess + (x / oldGuess)) / Fraction.Two;
            oldGuess = newGuess;
        } while ((oldGuess - newGuess).Abs() > tolerance);

If we're setting oldGuess = newGuess wouldn't the function simply exit on the first iteration?? 😆

lipchev added a commit to lipchev/Fractions that referenced this issue Dec 22, 2024
@lipchev lipchev linked a pull request Dec 22, 2024 that will close this issue
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 a pull request may close this issue.

1 participant