Commit f0266cb
authored
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.
1 parent 7a5101b commit f0266cb
File tree
3 files changed
+231
-105
lines changed- benches/bigdecimal
- docs
- src/decimojo/bigdecimal
3 files changed
+231
-105
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
758 | 759 | | |
759 | 760 | | |
760 | 761 | | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
761 | 842 | | |
762 | 843 | | |
763 | 844 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
0 commit comments