Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ DeciMojo is available in the [modular-community](https://repo.prefix.dev/modular
1. In the `mojoproject.toml` file of your project, add the following dependency:

```toml
decimojo = "==0.5.0"
decimojo = "==0.6.0"
```

Then run `pixi install` to download and install the package.
Expand All @@ -59,6 +59,7 @@ The following table summarizes the package versions and their corresponding Mojo
| v0.3.1 | >=25.2, <25.4 | pixi |
| v0.4.x | ==25.4 | pixi |
| v0.5.0 | ==25.5 | pixi |
| v0.6.0 | ==0.25.7 | pixi |

## Quick start

Expand Down Expand Up @@ -304,7 +305,7 @@ If you find DeciMojo useful for your research, consider listing it in your citat
year = {2025},
title = {An arbitrary-precision decimal and integer mathematics library for Mojo},
url = {https://github.com/forfudan/decimojo},
version = {0.5.0},
version = {0.6.0},
note = {Computer Software}
}
```
Expand Down
54 changes: 27 additions & 27 deletions benches/bigdecimal/bench_bigdecimal_round.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,15 @@ fn run_benchmark_round(
var t0 = perf_counter_ns()
for _ in range(iterations):
_ = mojo_value.round(decimal_places, rounding_mode_mojo)
var mojo_time = (perf_counter_ns() - t0) / iterations
var mojo_time = (perf_counter_ns() - t0) / UInt(iterations)
if mojo_time == 0:
mojo_time = 1 # Prevent division by zero

# Benchmark Python implementation
t0 = perf_counter_ns()
for _ in range(iterations):
_ = py_value.__round__(decimal_places)
var python_time = (perf_counter_ns() - t0) / iterations
var python_time = (perf_counter_ns() - t0) / UInt(iterations)

# Calculate speedup factor
var speedup = python_time / mojo_time
Expand Down Expand Up @@ -194,7 +194,7 @@ fn main() raises:
"Round down to integer",
"12.345",
0,
RoundingMode.ROUND_DOWN,
materialize[RoundingMode.ROUND_DOWN](),
"ROUND_DOWN",
iterations,
log_file,
Expand All @@ -206,7 +206,7 @@ fn main() raises:
"Round down to 1 decimal place",
"12.345",
1,
RoundingMode.ROUND_DOWN,
materialize[RoundingMode.ROUND_DOWN](),
"ROUND_DOWN",
iterations,
log_file,
Expand All @@ -218,7 +218,7 @@ fn main() raises:
"Round down negative to integer",
"-12.345",
0,
RoundingMode.ROUND_DOWN,
materialize[RoundingMode.ROUND_DOWN](),
"ROUND_DOWN",
iterations,
log_file,
Expand All @@ -232,7 +232,7 @@ fn main() raises:
"Round up to integer",
"12.345",
0,
RoundingMode.ROUND_UP,
materialize[RoundingMode.ROUND_UP](),
"ROUND_UP",
iterations,
log_file,
Expand All @@ -244,7 +244,7 @@ fn main() raises:
"Round up to 1 decimal place",
"12.345",
1,
RoundingMode.ROUND_UP,
materialize[RoundingMode.ROUND_UP](),
"ROUND_UP",
iterations,
log_file,
Expand All @@ -256,7 +256,7 @@ fn main() raises:
"Round up negative to integer",
"-12.345",
0,
RoundingMode.ROUND_UP,
materialize[RoundingMode.ROUND_UP](),
"ROUND_UP",
iterations,
log_file,
Expand All @@ -270,7 +270,7 @@ fn main() raises:
"Round half up to integer (0.5 -> 1)",
"12.5",
0,
RoundingMode.ROUND_HALF_UP,
materialize[RoundingMode.ROUND_HALF_UP](),
"ROUND_HALF_UP",
iterations,
log_file,
Expand All @@ -282,7 +282,7 @@ fn main() raises:
"Round half up to 1 decimal place (0.05 -> 0.1)",
"12.05",
1,
RoundingMode.ROUND_HALF_UP,
materialize[RoundingMode.ROUND_HALF_UP](),
"ROUND_HALF_UP",
iterations,
log_file,
Expand All @@ -294,7 +294,7 @@ fn main() raises:
"Round half up negative to integer (-0.5 -> -1)",
"-12.5",
0,
RoundingMode.ROUND_HALF_UP,
materialize[RoundingMode.ROUND_HALF_UP](),
"ROUND_HALF_UP",
iterations,
log_file,
Expand All @@ -308,7 +308,7 @@ fn main() raises:
"Round half even to integer (even digit)",
"12.5",
0,
RoundingMode.ROUND_HALF_EVEN,
materialize[RoundingMode.ROUND_HALF_EVEN](),
"ROUND_HALF_EVEN",
iterations,
log_file,
Expand All @@ -320,7 +320,7 @@ fn main() raises:
"Round half even to integer (odd digit)",
"13.5",
0,
RoundingMode.ROUND_HALF_EVEN,
materialize[RoundingMode.ROUND_HALF_EVEN](),
"ROUND_HALF_EVEN",
iterations,
log_file,
Expand All @@ -332,7 +332,7 @@ fn main() raises:
"Round half even to 1 decimal place (even digit)",
"12.25",
1,
RoundingMode.ROUND_HALF_EVEN,
materialize[RoundingMode.ROUND_HALF_EVEN](),
"ROUND_HALF_EVEN",
iterations,
log_file,
Expand All @@ -346,7 +346,7 @@ fn main() raises:
"Round to higher precision (add zeros)",
"12.345",
5,
RoundingMode.ROUND_HALF_EVEN,
materialize[RoundingMode.ROUND_HALF_EVEN](),
"ROUND_HALF_EVEN",
iterations,
log_file,
Expand All @@ -358,7 +358,7 @@ fn main() raises:
"Negative decimal places (round to tens)",
"123.456",
-1,
RoundingMode.ROUND_HALF_EVEN,
materialize[RoundingMode.ROUND_HALF_EVEN](),
"ROUND_HALF_EVEN",
iterations,
log_file,
Expand All @@ -370,7 +370,7 @@ fn main() raises:
"Negative decimal places (round to hundreds)",
"123.456",
-2,
RoundingMode.ROUND_HALF_EVEN,
materialize[RoundingMode.ROUND_HALF_EVEN](),
"ROUND_HALF_EVEN",
iterations,
log_file,
Expand All @@ -384,7 +384,7 @@ fn main() raises:
"Round zero",
"0",
2,
RoundingMode.ROUND_HALF_EVEN,
materialize[RoundingMode.ROUND_HALF_EVEN](),
"ROUND_HALF_EVEN",
iterations,
log_file,
Expand All @@ -396,7 +396,7 @@ fn main() raises:
"Round very small number",
"0.0000000000000000000000001",
10,
RoundingMode.ROUND_HALF_EVEN,
materialize[RoundingMode.ROUND_HALF_EVEN](),
"ROUND_HALF_EVEN",
iterations,
log_file,
Expand All @@ -408,7 +408,7 @@ fn main() raises:
"Round very large number",
"9999999999.99999",
2,
RoundingMode.ROUND_HALF_EVEN,
materialize[RoundingMode.ROUND_HALF_EVEN](),
"ROUND_HALF_EVEN",
iterations,
log_file,
Expand All @@ -420,7 +420,7 @@ fn main() raises:
"Round with carry over (9.9999 -> 10)",
"9.9999",
0,
RoundingMode.ROUND_HALF_EVEN,
materialize[RoundingMode.ROUND_HALF_EVEN](),
"ROUND_HALF_EVEN",
iterations,
log_file,
Expand All @@ -432,7 +432,7 @@ fn main() raises:
"Round exactly half (down)",
"10.5",
0,
RoundingMode.ROUND_DOWN,
materialize[RoundingMode.ROUND_DOWN](),
"ROUND_DOWN",
iterations,
log_file,
Expand All @@ -443,7 +443,7 @@ fn main() raises:
"Round exactly half (up)",
"10.5",
0,
RoundingMode.ROUND_UP,
materialize[RoundingMode.ROUND_UP](),
"ROUND_UP",
iterations,
log_file,
Expand All @@ -454,7 +454,7 @@ fn main() raises:
"Round exactly half (half up)",
"10.5",
0,
RoundingMode.ROUND_HALF_UP,
materialize[RoundingMode.ROUND_HALF_UP](),
"ROUND_HALF_UP",
iterations,
log_file,
Expand All @@ -465,7 +465,7 @@ fn main() raises:
"Round exactly half (half even)",
"10.5",
0,
RoundingMode.ROUND_HALF_EVEN,
materialize[RoundingMode.ROUND_HALF_EVEN](),
"ROUND_HALF_EVEN",
iterations,
log_file,
Expand All @@ -479,7 +479,7 @@ fn main() raises:
"Round scientific notation value",
"1.2345e5",
2,
RoundingMode.ROUND_HALF_EVEN,
materialize[RoundingMode.ROUND_HALF_EVEN](),
"ROUND_HALF_EVEN",
iterations,
log_file,
Expand All @@ -491,7 +491,7 @@ fn main() raises:
"Round small scientific notation value",
"1.2345e-5",
8,
RoundingMode.ROUND_HALF_EVEN,
materialize[RoundingMode.ROUND_HALF_EVEN](),
"ROUND_HALF_EVEN",
iterations,
log_file,
Expand Down
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This is a list of RELEASED changes for the DeciMojo Package.

## 20251216 (v0.6.0)

DeciMojo v0.6.0 updates the codebase to Mojo v25.7, adopting the new `TestSuite` type for improved test organization. All tests have been refactored to use the native Mojo testing framework instead of the deprecated `pixi test` command.

## 20250806 (v0.5.0)

DeciMojo v0.5.0 introduces significant enhancements to the `BigDecimal` and `BigUInt` types, including new mathematical functions and performance optimizations. The release adds **trigonometric functions** for `BigDecimal`, implements the **Chudnovsky algorithm** for computing π, and implements the **Karatsuba multiplication algorithm** and **Burnikel-Ziegler division algorithm** for `BigUInt`. In-place operations, slice operations, and SIMD operations are now supported for `BigUInt` arithmetic. The `Decimal` type is renamed to `Decimal128` to reflect its 128-bit fixed precision. The release also includes improved error handling, optimized type conversions, refactored testing suites, and documentation updates.
Expand Down
5 changes: 3 additions & 2 deletions docs/readme_zht.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ DeciMojo 可在 [modular-community](https://repo.prefix.dev/modular-community)
1. 在您項目的 `mojoproject.toml` 文件中,添加以下依賴:

```toml
decimojo = "==0.5.0"
decimojo = "==0.6.0"
```

然後運行 `pixi install` 來下載並安裝包。
Expand All @@ -59,6 +59,7 @@ DeciMojo 可在 [modular-community](https://repo.prefix.dev/modular-community)
| v0.3.1 | >=25.2, <25.4 | pixi |
| v0.4.x | ==25.4 | pixi |
| v0.5.0 | ==25.5 | pixi |
| v0.6.0 | ==0.25.7 | pixi |

## 快速開始

Expand Down Expand Up @@ -306,7 +307,7 @@ DeciMojo 結合了 "Deci" 和 "Mojo" 兩詞,反映了其目的和實現語言
year = {2025},
title = {An arbitrary-precision decimal and integer mathematics library for Mojo},
url = {https://github.com/forfudan/decimojo},
version = {0.5.0},
version = {0.6.0},
note = {Computer Software}
}
```
Expand Down