Commit 3cc20ea
authored
[integer] Update functions and methods for
This pull request includes significant updates to the BigInt and BigUInt
benchmark functionalities and arithmetic operations. The changes add new
benchmark options and refactor the internal representation of BigInt
operations to use the `magnitude` attribute instead of `words`.
### Benchmark Updates:
*
[`benches/bigint/bench.mojo`](diffhunk://#diff-2a97f8dc8465f7a88d361dcee4dcb3020bd75f18a3a189e817fb9af8996bbb75R3-R35):
Added a new benchmark for floor division and updated the main function
to include options for running different benchmarks.
*
[`benches/biguint/bench.mojo`](diffhunk://#diff-34a58f6f5c1b673b01199db91a3b182f1f345caf0797cbcacadd978e96e4cc10R7-R35):
Updated the main function to include a menu for running different
benchmarks.
### Refactoring BigInt Operations:
*
[`src/decimojo/bigint/arithmetics.mojo`](diffhunk://#diff-1ffcd7baf2074053c5e9680efda5d243ac5a3096ebf39049f4670a48bc0a932fL54-R56):
Refactored the `add`, `subtract`, `multiply`, and `truncate_divide`
functions to use `magnitude.words` instead of `words` for internal
operations. This change affects how the arithmetic operations handle the
internal representation of BigInt.
[[1]](diffhunk://#diff-1ffcd7baf2074053c5e9680efda5d243ac5a3096ebf39049f4670a48bc0a932fL54-R56)
[[2]](diffhunk://#diff-1ffcd7baf2074053c5e9680efda5d243ac5a3096ebf39049f4670a48bc0a932fL63-R84)
[[3]](diffhunk://#diff-1ffcd7baf2074053c5e9680efda5d243ac5a3096ebf39049f4670a48bc0a932fL117-R167)
[[4]](diffhunk://#diff-1ffcd7baf2074053c5e9680efda5d243ac5a3096ebf39049f4670a48bc0a932fL204-R213)
[[5]](diffhunk://#diff-1ffcd7baf2074053c5e9680efda5d243ac5a3096ebf39049f4670a48bc0a932fL218-R309)
[[6]](diffhunk://#diff-1ffcd7baf2074053c5e9680efda5d243ac5a3096ebf39049f4670a48bc0a932fL296-R341)
[[7]](diffhunk://#diff-1ffcd7baf2074053c5e9680efda5d243ac5a3096ebf39049f4670a48bc0a932fL307-R377)
[[8]](diffhunk://#diff-1ffcd7baf2074053c5e9680efda5d243ac5a3096ebf39049f4670a48bc0a932fL344-R442)
[[9]](diffhunk://#diff-1ffcd7baf2074053c5e9680efda5d243ac5a3096ebf39049f4670a48bc0a932fL404-R454)
[[10]](diffhunk://#diff-1ffcd7baf2074053c5e9680efda5d243ac5a3096ebf39049f4670a48bc0a932fL416-R488)
[[11]](diffhunk://#diff-1ffcd7baf2074053c5e9680efda5d243ac5a3096ebf39049f4670a48bc0a932fL472-R530)
### New Functionality:
*
[`src/decimojo/bigint/arithmetics.mojo`](diffhunk://#diff-1ffcd7baf2074053c5e9680efda5d243ac5a3096ebf39049f4670a48bc0a932fL452-R509):
Added a new function `floor_divide` to perform floor division on BigInt
numbers, rounding towards negative infinity.BigUInt (#59)1 parent a4ef3b1 commit 3cc20ea
File tree
11 files changed
+2901
-789
lines changed- benches
- bigint
- biguint
- src/decimojo
- bigint
- biguint
- tests/bigint
11 files changed
+2901
-789
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | | - | |
7 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
0 commit comments