Skip to content

Add gcd(0, 0) edge case to doctests#14215

Merged
MaximSmolskiy merged 10 commits intoTheAlgorithms:masterfrom
yaadhuu:fix-gcd-edge-case
Mar 9, 2026
Merged

Add gcd(0, 0) edge case to doctests#14215
MaximSmolskiy merged 10 commits intoTheAlgorithms:masterfrom
yaadhuu:fix-gcd-edge-case

Conversation

@yaadhuu
Copy link
Contributor

@yaadhuu yaadhuu commented Jan 26, 2026

Describe your change:

  • Fix a bug or typo in an existing algorithm?

This pull request handles the edge case where both inputs to the
Greatest Common Divisor (GCD) function are zero (gcd(0, 0)), which was
previously undefined. Doctests have been added to document and verify
the expected behavior.

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, separate PRs are used for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.

@algorithms-keeper algorithms-keeper bot added enhancement This PR modified some existing files awaiting reviews This PR is ready to be reviewed labels Jan 26, 2026
@algorithms-keeper algorithms-keeper bot removed the awaiting reviews This PR is ready to be reviewed label Mar 9, 2026
@MaximSmolskiy MaximSmolskiy changed the title Handle gcd(0, 0) edge case Add gcd(0, 0) edge case to doctests Mar 9, 2026
@MaximSmolskiy MaximSmolskiy merged commit 84b59c8 into TheAlgorithms:master Mar 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement This PR modified some existing files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants