C-Plus-Plus icon indicating copy to clipboard operation
C-Plus-Plus copied to clipboard

fix: make interface of `NCRModuloP` fail-safe

Open vil02 opened this issue 2 years ago • 5 comments

Description of Change

The original implementation of NCRModuloP, has two problems:

  • the member variable fac is one element too short,
  • the computation math::ncr_modulo_p::NCRModuloP(100, 43).ncr(10, 3, 13) returns 2, which is incorrect since10C3 = 120 and 120%13 = 3 (note different values of p).

This PR fixes above issues and does some minor refactoring, style improvements and adds missing test cases.

Checklist

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

Notes: Updates to fail-safe API of NCRModuloP

vil02 avatar May 21 '23 10:05 vil02

Please do not resolve unless you have instructions to do so or the changes are sufficiently discussed

realstealthninja avatar Jun 17 '23 00:06 realstealthninja

@Panquesito7 could you please have a final look?

vil02 avatar Jul 13 '23 06:07 vil02

@Panquesito7, @realstealthninja could you please have a final look?

vil02 avatar Sep 08 '23 21:09 vil02

This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Dec 27 '23 00:12 github-actions[bot]

@Panquesito7, @realstealthninja please dont-close.

vil02 avatar Dec 27 '23 19:12 vil02