Skip to content

Commit 9359e6a

Browse files
authored
[integer] Refine arithmetic functions of BigUInt (#98)
Refine the arithmetic functions for `BigUInt` 1. Add `subtract_inplace()` 2. Optimize the cases when the second argument is one-word long. 3. Refine the estimation of quotient for division using 3-by-2 division. 4. Update the function `is_one()` and `is_two`. 5. Remove unused function `floor_divide_partition()`.
1 parent 8abc559 commit 9359e6a

File tree

6 files changed

+650
-210
lines changed

6 files changed

+650
-210
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ DeciMojo provides an arbitrary-precision decimal and integer mathematics library
2121
The core types are:
2222

2323
- A base-10 arbitrary-precision signed integer type (`BigInt`) and a base-10 arbitrary-precision unsigned integer type (`BigUInt`) supporting unlimited digits[^integer]. It features comprehensive arithmetic operations, comparison functions, and supports extremely large integer calculations efficiently.
24-
- An arbitrary-precision decimal implementation `BigDecimal` allowing for calculations with unlimited digits and decimal places[^arbitrary].
24+
- An arbitrary-precision decimal implementation `BigDecimal` allowing for calculations with unlimited digits and decimal places[^arbitrary]. It provides a complete set of arithmetic operations, comparisons, and mathematical functions like logarithms, exponentiation, roots, trigonometric functions, etc. It also supports rounding modes and conversions to/from built-in types.
2525
- A 128-bit fixed-point decimal implementation (`Decimal`) supporting up to 29 significant digits with a maximum of 28 decimal places[^fixed]. It features a complete set of mathematical functions including logarithms, exponentiation, roots, etc.
2626

2727
This repository includes [TOMLMojo](https://github.com/forfudan/decimojo/tree/main/src/tomlmojo), a lightweight TOML parser in pure Mojo. It parses configuration files and test data, supporting basic types, arrays, and nested tables. While created for DeciMojo's testing framework, it offers general-purpose structured data parsing with a clean, simple API.

benches/biguint/bench.mojo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This is the BigUInt Benchmarks
1212
=========================================
1313
add: Add
1414
mul: Multiply
15-
trunc: Truncate divide (//)
15+
div: Truncate divide (//)
1616
fromstr: From string
1717
all: Run all benchmarks
1818
q: Exit
@@ -24,7 +24,7 @@ q: Exit
2424
bench_add()
2525
elif command == "mul":
2626
bench_multiply()
27-
elif command == "trunc":
27+
elif command == "div":
2828
bench_truncate_divide()
2929
elif command == "fromstr":
3030
bench_from_string()

0 commit comments

Comments
 (0)