Skip to content

fix(math): modernize power_of_two to fit contribution guidelines (#2456) - #3254

Open
akhila-pynam wants to merge 1 commit into
TheAlgorithms:masterfrom
akhila-pynam:fix/power-of-two-guidelines
Open

akhila-pynam wants to merge 1 commit into
TheAlgorithms:masterfrom
akhila-pynam:fix/power-of-two-guidelines

Conversation

@akhila-pynam

Copy link
Copy Markdown

Description of Change

Refactors math/power_of_two.cpp to comply with repository contribution guidelines:

  • Fixed the mathematical bug where 0 evaluated to a power of 2.
  • Changed the return type from int (1/0) to idiomatic C++ bool (true/false).
  • Removed the deprecated user_input_test() function containing interactive std::cin input.
  • Added standard Doxygen docblocks (@brief, @param, @return).
  • Added comprehensive self-tests with assert() covering 0, 1 ($2^0$), powers of 2, and non-powers of 2.

Fixes part of #2456

Checklist

  • Added description of change
  • Added tests and example, test must pass
  • Added documentation so that the program is self-explanatory and educational - Doxygen guidelines
  • Relevant documentation/comments is changed or added
  • PR title follows semantic commit guidelines
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.

Notes: Modernized math/power_of_two.cpp to adhere to contribution guidelines.

This branch has not been deployed

No deployments
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.

1 participant