Skip to content

[integer][decimal] Implement factorial() for BigInt and BigDecimal#254

Merged
forfudan merged 2 commits into
mainfrom
dev
Jun 25, 2026
Merged

[integer][decimal] Implement factorial() for BigInt and BigDecimal#254
forfudan merged 2 commits into
mainfrom
dev

Conversation

@forfudan

@forfudan forfudan commented Jun 24, 2026

Copy link
Copy Markdown
Owner

This PR adds factorial support for Decimo’s arbitrary-precision numeric types, exposing factorial() as a standalone function in new special modules and as instance methods on BigInt and BigDecimal.

Changes:

  • Added decimo.bigint.special.factorial() and wired it into BigInt.factorial().
  • Added decimo.bigdecimal.special.factorial(x, precision=0) (exact and rounded modes) and wired it into BigDecimal.factorial(...).
  • Updated module documentation to include the new special modules (and number_theory in the BigInt package doc).

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds factorial support for Decimo’s arbitrary-precision numeric types, exposing factorial() as a standalone function in new special modules and as instance methods on BigInt and BigDecimal.

Changes:

  • Added decimo.bigint.special.factorial() and wired it into BigInt.factorial().
  • Added decimo.bigdecimal.special.factorial(x, precision=0) (exact and rounded modes) and wired it into BigDecimal.factorial(...).
  • Updated module documentation to include the new special modules (and number_theory in the BigInt package doc).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/decimo/bigint/special.mojo Introduces factorial(BigInt) implementation and input cap.
src/decimo/bigint/bigint.mojo Adds BigInt.factorial() method and imports the new special module.
src/decimo/bigint/init.mojo Updates BigInt package module listing/documentation.
src/decimo/bigdecimal/special.mojo Introduces factorial(BigDecimal, precision) with exact and rounded paths.
src/decimo/bigdecimal/bigdecimal.mojo Adds BigDecimal.factorial(...) method and imports the new special module; minor docstring tweak.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/decimo/bigdecimal/special.mojo Outdated
Comment thread src/decimo/bigint/special.mojo
Comment thread src/decimo/bigdecimal/special.mojo
Comment thread src/decimo/bigint/bigint.mojo
Comment thread src/decimo/bigdecimal/bigdecimal.mojo
@forfudan forfudan merged commit 2b4cbb8 into main Jun 25, 2026
11 checks passed
@forfudan forfudan deleted the dev branch June 25, 2026 20:16
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.

2 participants