Skip to content

fix(math): modernize armstrong_number to fit contribution guidelines (#2456) - #3253

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

akhila-pynam wants to merge 1 commit into
TheAlgorithms:masterfrom
akhila-pynam:fix/armstrong-guidelines

Conversation

@akhila-pynam

Copy link
Copy Markdown

Description of Change

Refactors math/armstrong_number.cpp to fit the repository contribution guidelines:

  • Enclosed functions inside namespace math.
  • Replaced floating-point std::pow with an integer binary exponentiation power function to prevent precision issues.
  • Fixed number_of_digits to correctly return 1 for 0.
  • Added standard Doxygen docblocks (@brief, @param, @return).
  • Added comprehensive self-tests with assert() covering 0, single-digit, multi-digit, and non-Armstrong cases.

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/armstrong_number.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