Skip to content

Conversation

@forfudan
Copy link
Owner

This pull request introduces enhancements to the BigDecimal division functionality, including refactoring of the true_divide function and the implementation of two new division methods: true_divide_fast and true_divide_general. These changes aim to improve precision, performance, and code maintainability.

Division Function Refactoring:

  • Refactored the true_divide function to simplify logic and delegate division tasks to specialized helper functions (true_divide_fast and true_divide_general). This improves readability and separates concerns.

New Division Methods:

  • true_divide_fast: Introduced a high-performance division method that avoids rounding and trailing zero removal, suitable for cases where speed is prioritized over formatting.
  • true_divide_general: Added a precise division method that rounds results to the specified precision and removes unnecessary trailing zeros, ensuring compliance with exact division requirements.

Code Simplification:

  • Replaced unused imports (time and testing) with math in arithmetics.mojo, aligning dependencies with the updated implementation.

Benchmark Enhancements:

  • Added new benchmark cases (Cases 57–64) to test division of BigDecimal numbers with varying word sizes, including extremely large numbers. These cases use the newly introduced ITERATIONS_LARGE_NUMBERS constant for iterations.

@forfudan forfudan merged commit f0266cb into main Jul 18, 2025
1 check passed
@forfudan forfudan deleted the work branch July 18, 2025 20:37
forfudan added a commit that referenced this pull request Jul 18, 2025
forfudan added a commit that referenced this pull request Jul 24, 2025
forfudan added a commit that referenced this pull request Jul 26, 2025
forfudan added a commit that referenced this pull request Jul 31, 2025
forfudan added a commit that referenced this pull request Aug 3, 2025
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