Skip to content

refactor: simplify exponent parity responsibility in modularBinaryExp… - #64

Open
9808Tarun wants to merge 1 commit into
S-AI-Projects:masterfrom
9808Tarun:student/e26b07f0633/R50-T026
Open

9808Tarun wants to merge 1 commit into
S-AI-Projects:masterfrom
9808Tarun:student/e26b07f0633/R50-T026

Conversation

@9808Tarun

Copy link
Copy Markdown

Description
Refactored exponent parity evaluation in modularBinaryExponentiation (Maths/ModularBinaryExponentiationRecursive.js) into an explicit predicate helper to improve code clarity while preserving exact algorithm behavior.

Related Issue
Fixes: #26

Type of Change

  • Bug Fix
  • New Feature
  • UI/UX Improvement
  • Performance Improvement
  • Tests
  • Documentation
  • Refactoring / Maintenance
  • CI/CD

Changes Made

  • Extracted isOddExponent predicate in Maths/ModularBinaryExponentiationRecursive.js to make the recursive branching step explicitly named and readable.
  • Tested smallest valid input (base=2, exponent=0, mod=5 -> 1) and ordinary input (base=2, exponent=10, mod=1000 -> 24), referencing precondition source line 9.
  • Added equivalence tests in Maths/test/ModularBinaryExponentiationRecursive.test.js across odd/even exponent cases.
  • Created work/R50-T026/check.py to non-interactively run tests and log fixture results and versions.

Screenshots / Recordings
N/A

Testing

  • Executed python3 work/R50-T026/check.py locally.
  • Verified test suite passes for Maths/test/ModularBinaryExponentiationRecursive.test.js.

Checklist

  • I have tested my changes locally.
  • I have added or updated tests, if needed.
  • I have updated documentation, if needed.
  • I have followed the project's coding guidelines.
  • I have run the relevant tests and checks.
  • I have addressed previous review feedback, if applicable.

Additional Notes
N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant