Content-Length: 356103 | pFad | https://github.com/TheAlgorithms/Go/pull/705

6B style: handle edge cases uniformly in all implementations of factorial by vil02 · Pull Request #705 · TheAlgorithms/Go · GitHub
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

style: handle edge cases uniformly in all implementations of factorial #705

Merged
merged 6 commits into from
Mar 18, 2024

Conversation

vil02
Copy link
Member

@vil02 vil02 commented Feb 12, 2024

Current implementations of the factorial react differently for negative inputs. This PR fixes that. Furthermore it reduced the code duplication in the corresponding test file by expressing tests and benchmarks as parameterized.

@codecov-commenter
Copy link

codecov-commenter commented Feb 12, 2024

Codecov Report

Attention: Patch coverage is 91.66667% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 86.73%. Comparing base (0254892) to head (e9c894f).

Files Patch % Lines
math/catalan/catalannumber.go 66.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #705      +/-   ##
==========================================
+ Coverage   86.65%   86.73%   +0.08%     
==========================================
  Files         197      197              
  Lines        6519     6530      +11     
==========================================
+ Hits         5649     5664      +15     
+ Misses        730      727       -3     
+ Partials      140      139       -1     

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

@vil02 vil02 force-pushed the make_factorial_uniform branch from e4b49cd to d210374 Compare February 12, 2024 19:20
@vil02 vil02 marked this pull request as ready for review February 12, 2024 19:25
@vil02 vil02 marked this pull request as draft February 14, 2024 15:47
@vil02 vil02 marked this pull request as ready for review February 14, 2024 16:07
@vil02 vil02 requested a review from tjgurwara99 February 15, 2024 15:58
Copy link

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

Copy link
Member

@raklaptudirm raklaptudirm left a comment

Choose a reason for hiding this comment

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

Instead of erroredResult, ErrNegativeArgument just return 0, ErrNegativeArgument since the caller is not supposed to use the result value if err != nil.

@vil02 vil02 requested a review from raklaptudirm March 17, 2024 11:13
@vil02
Copy link
Member Author

vil02 commented Mar 17, 2024

Instead of erroredResult, ErrNegativeArgument just return 0, ErrNegativeArgument since the caller is not supposed to use the result value if err != nil.

Done in e9c894f.

@raklaptudirm raklaptudirm merged commit 50ddbdd into TheAlgorithms:master Mar 18, 2024
5 checks passed
@vil02 vil02 deleted the make_factorial_uniform branch March 18, 2024 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/TheAlgorithms/Go/pull/705

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy