Skip to content

fix: hadnle zeros at the endpoints in BisectionMethod #1640

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

Merged
merged 2 commits into from
Apr 3, 2024

Conversation

vil02
Copy link
Member

@vil02 vil02 commented Mar 7, 2024

Open in Gitpod know more

Describe your change:

findRoot errors when one is trying to find a root for x^3 on the interval [-1, 1]. This PR fixes that and adds a test cave case covering:

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new JavaScript files are placed inside an existing directory.
  • All filenames should use the UpperCamelCase (PascalCase) style. There should be no spaces in filenames.
    Example:UserProfile.js is allowed but userprofile.js,Userprofile.js,user-Profile.js,userProfile.js are not
  • All new algorithms have a URL in their comments that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

@vil02 vil02 marked this pull request as ready for review March 7, 2024 22:15
@codecov-commenter
Copy link

codecov-commenter commented Mar 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.09%. Comparing base (bd34e9f) to head (f2f10bd).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1640      +/-   ##
==========================================
+ Coverage   84.07%   84.09%   +0.02%     
==========================================
  Files         375      375              
  Lines       19688    19687       -1     
  Branches     2913     2914       +1     
==========================================
+ Hits        16552    16556       +4     
+ Misses       3136     3131       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vil02 vil02 force-pushed the fix_bisection_method branch from d4baaca to ab6ffc9 Compare March 17, 2024 18:33
@vil02 vil02 force-pushed the fix_bisection_method branch from ab6ffc9 to f2f10bd Compare March 17, 2024 18:39
raklaptudirm
raklaptudirm previously approved these changes Mar 18, 2024
@vil02 vil02 changed the title fix: hadnle zeros at the endpoints fix: hadnle zeros at the endpoints BisectionMethod Mar 18, 2024
@vil02 vil02 changed the title fix: hadnle zeros at the endpoints BisectionMethod fix: hadnle zeros at the endpoints in BisectionMethod Mar 18, 2024
appgurueu
appgurueu previously approved these changes Mar 26, 2024
Copy link
Collaborator

@appgurueu appgurueu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Math.pow(x, n) can be written as x**n btw, so you could simply write x => x ** 2 for example.

@vil02 vil02 dismissed stale reviews from appgurueu and raklaptudirm via c7cda09 March 26, 2024 22:07
@vil02 vil02 requested review from appgurueu and raklaptudirm March 26, 2024 22:19
@raklaptudirm raklaptudirm merged commit 34a663a into TheAlgorithms:master Apr 3, 2024
3 checks passed
@vil02 vil02 deleted the fix_bisection_method branch April 3, 2024 16:36
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.

4 participants