Conversation
There was a problem hiding this comment.
Pull request overview
This PR aligns BigDecimal’s API more closely with Python’s decimal.Decimal by renaming the scientific-notation exponent helper to adjusted() and adding sign-copying convenience methods, then updates internal call sites and documentation/tests accordingly.
Changes:
- Rename
BigDecimal.exponent()toBigDecimal.adjusted()and update call sites in exponential math routines. - Add
copy_abs(),copy_negate(), andcopy_sign()toBigDecimal. - Add/extend tests and update the API roadmap to reflect the new/renamed methods.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| tests/bigdecimal/test_bigdecimal_methods.mojo | Adds tests for copy_* methods and adjusted(). |
| src/decimo/bigdecimal/exponential.mojo | Replaces exponent() usages with adjusted() in exp/ln/sqrt-related logic. |
| src/decimo/bigdecimal/bigdecimal.mojo | Implements adjusted() and introduces copy_abs/copy_negate/copy_sign. |
| docs/plans/api_roadmap.md | Marks adjusted() and copy_* methods as done. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
forfudan
added a commit
that referenced
this pull request
Mar 23, 2026
…negate()` + `copy_sign()` (#176) Related to Issue #175 . This PR aligns `BigDecimal`’s API more closely with Python’s `decimal.Decimal` by renaming the scientific-notation exponent helper to `adjusted()` and adding sign-copying convenience methods, then updates internal call sites and documentation/tests accordingly. **Changes:** - Rename `BigDecimal.exponent()` to `BigDecimal.adjusted()` and update call sites in exponential math routines. Note that `0.00` now returns 0 rather than 2. - Add `copy_abs()`, `copy_negate()`, and `copy_sign()` to `BigDecimal`. - Add/extend tests and update the API roadmap to reflect the new/renamed methods.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to Issue #175 .
This PR aligns
BigDecimal’s API more closely with Python’sdecimal.Decimalby renaming the scientific-notation exponent helper toadjusted()and adding sign-copying convenience methods, then updates internal call sites and documentation/tests accordingly.Changes:
BigDecimal.exponent()toBigDecimal.adjusted()and update call sites in exponential math routines. Note that0.00now returns 0 rather than 2.copy_abs(),copy_negate(), andcopy_sign()toBigDecimal.