Skip to content

Commit f2930f0

Browse files
authored
[docs] Update documents for release (#84)
This pull request includes updates to the DeciMojo package, primarily focusing on version upgrades and the introduction of new features. The most significant changes involve the addition of the `BigDecimal` type, improvements to existing functionalities, and updates to documentation to reflect the new version.
1 parent eb95520 commit f2930f0

File tree

5 files changed

+32
-35
lines changed

5 files changed

+32
-35
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ DeciMojo is available in the [modular-community](https://repo.prefix.dev/modular
3939

4040
From the `magic` CLI, simply run ```magic add decimojo```. This fetches the latest version and makes it immediately available for import.
4141

42-
For projects with a `mojoproject.toml`file, add the dependency ```decimojo = ">=0.2.0"```. Then run `magic install` to download and install the package.
42+
For projects with a `mojoproject.toml`file, add the dependency ```decimojo = ">=0.3.0"```. Then run `magic install` to download and install the package.
4343

4444
For the latest development version, clone the [GitHub repository](https://github.com/forfudan/decimojo) and build the package locally.
4545

@@ -216,7 +216,7 @@ If you find DeciMojo useful for your research, consider listing it in your citat
216216
year = {2025},
217217
title = {An arbitrary-precision decimal and integer mathematics library for Mojo},
218218
url = {https://github.com/forfudan/decimojo},
219-
version = {0.2.0},
219+
version = {0.3.0},
220220
note = {Computer Software}
221221
}
222222
```

docs/changelog.md

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,33 @@
22

33
This is a list of RELEASED changes for the DeciMojo Package. For the unreleased changes, please refer to **[changelog_unreleased](https://zhuyuhao.com/decimojo/docs/changelog_unreleased.html)**.
44

5+
## 15/04/2025 (v0.3.0)
6+
7+
DeciMojo v0.3.0 introduces the arbitrary-precision `BigDecimal` type with comprehensive arithmetic operations, comparisons, and mathematical functions (`sqrt`, `root`, `log`, `exp`, `power`). A new `tomlmojo` package supports test refactoring. Improvements include refined `BigUInt` constructors, enhanced `scale_up_by_power_of_10()` functionality, and a critical multiplication bug fix.
8+
9+
### ⭐️ New
10+
11+
- Implement the `BigDecimal` type with unlimited precision arithmetic.
12+
- Implement basic arithmetic operations for `BigDecimal`: addition, subtraction, multiplication, division, and modulo.
13+
- Implement comparison operations for `BigDecimal`: less than, greater than, equal to, and not equal to.
14+
- Implement string representation and parsing for `BigDecimal`.
15+
- Implement mathematical operations for `BigDecimal`: `sqrt`, `nroot`, `log`, `exp`, and `power` functions.
16+
- Iimplement rounding functions.
17+
- Implement a simple TOML parser as package `tomlmojo` to refactor tests (PR #63).
18+
19+
### 🦋 Changed
20+
21+
- Refine the constructors of `BigUInt` (PR #64).
22+
- Improve the method `BigUInt.scale_up_by_power_of_10()` (PR #72).
23+
24+
### 🛠️ Fixed
25+
26+
- Fix a bug in `BigUInt` multiplication where the calcualtion of carry is mistakenly skipped if a word of x2 is zero (PR #70).
27+
528
## 01/04/2025 (v0.2.0)
629

730
Version 0.2.0 marks a significant expansion of DeciMojo with the introduction of `BigInt` and `BigUInt` types, providing unlimited precision integer arithmetic to complement the existing fixed-precision `Decimal` type. Core arithmetic functions for the `Decimal` type have been completely rewritten using Mojo 25.2's `UInt128`, delivering substantial performance improvements. This release also extends mathematical capabilities with advanced operations including logarithms, exponentials, square roots, and n-th roots for the `Decimal` type. The codebase has been reorganized into a more modular structure, enhancing maintainability and extensibility. With comprehensive test coverage, improved documentation in multiple languages, and optimized memory management, v0.2.0 represents a major advancement in both functionality and performance for numerical computing in Mojo.
831

9-
DeciMojo division performance compared with Python's `decimal` module across versions:
10-
11-
| Division Operation | v0.1.0 vs Python | v0.2.0 vs Python | Improvement |
12-
| --------------------------------- | ---------------- | ---------------- | ----------- |
13-
| Integer division (no remainder) | 0.15× (slower) | 485.88× faster | 3239× |
14-
| Simple decimal division | 0.13× (slower) | 185.77× faster | 1429× |
15-
| Division with repeating decimal | 0.04× (slower) | 12.46× faster | 311× |
16-
| Division by one | 0.15× (slower) | 738.60× faster | 4924× |
17-
| Division of zero | 1820.50× faster | 1866.50× faster | 1.03× |
18-
| Division with negative numbers | 0.11× (slower) | 159.32× faster | 1448× |
19-
| Division by very small number | 0.21× (slower) | 452.75× faster | 2156× |
20-
| High precision division | 0.005× (slower) | 15.19× faster | 3038× |
21-
| Division resulting in power of 10 | 0.21× (slower) | 619.00× faster | 2948× |
22-
| Division of very large numbers | 0.06× (slower) | 582.86× faster | 9714× |
23-
24-
_Note: Benchmarks performed on Darwin 24.3.0, arm processor with Python 3.12.9. The dramatic performance improvements in v0.2.0 come from completely rewriting the division algorithm using Mojo 25.2's UInt128 implementation. While v0.1.0 was generally slower than Python for division operations (except for division of zero), v0.2.0 achieves speedups of 12-1866× depending on the specific scenario._
25-
2632
### ⭐️ New
2733

2834
- Add comprehensive `BigInt` and `BigUInt` implementation with unlimited precision integer arithmetic.

docs/changelog_unreleased.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
11
# DeciMojo unreleased changelog
22

33
This is a list of UNRELEASED changes for the DeciMojo Package. For the released changes, please refer to **[changelog](https://zhuyuhao.com/decimojo/docs/changelog.html)**.
4-
5-
### ⭐️ New
6-
7-
- Add comprehensive `BigDecimal` implementation with unlimited precision arithmetic.
8-
9-
### 🛠️ Fixed
10-
11-
- Fix a bug in `BigUInt` multiplication where the calcualtion of carry is mistakenly skipped if a word of x2 is zero (PR #70).

docs/readme_zht.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@ DeciMojo 爲 Mojo 提供了全面的定點數和整數運算庫,專爲處理
1010

1111
核心類型包括:
1212

13-
- 一種 128 位定點數實現 (`Decimal`) 支持最多 29 位有效數字,小數點後最多 28 位數字[^fixed]。它具有完整的數學函數集,包括對數、指數、開方和三角函數運算。
14-
- 一種基於 10 進制的任意精度有符號整數類型 (`BigInt`) 和任意精度無符號整數類型 (`BigUInt`)[^integer],支持無限位數。它具有全面的算術運算、比較功能,並能高效支持超大整數計算。
15-
16-
該庫正在擴展,計劃包含支持任意精度的 `BigDecimal` 類型[^arbitrary],允許進行無限位數和小數位的計算。這些擴展目前正在積極開發中。
13+
- 128 位定點數 (`Decimal`),支持最多 29 位有效數字,小數點後最多 28 位數字[^fixed]
14+
- 任意精度定點數 (`BigDecimal`) ,允許進行無限位數和小數位的計算。
15+
- 基於 10 進制的任意精度有符號整數 (`BigInt`) 和任意精度無符號整數 (`BigUInt`)[^integer],支持無限位數。它具有全面的算術運算、比較功能,並能高效支持超大整數計算。
1716

1817
## 安裝
1918

2019
DeciMojo 可在 [modular-community](https://repo.prefix.dev/modular-community) 包倉庫中獲取。您可以使用以下任一方法進行安裝:
2120

2221
`magic` CLI,只需運行 ```magic add decimojo```。這會獲取最新版本並使其立即可用於導入。
2322

24-
對於帶有 `mojoproject.toml` 文件的項目,添加依賴 ```decimojo = ">=0.2.0"```。然後運行 `magic install` 來下載並安裝包。
23+
對於帶有 `mojoproject.toml` 文件的項目,添加依賴 ```decimojo = ">=0.3.0"```。然後運行 `magic install` 來下載並安裝包。
2524

2625
如需最新的開發版本,請克隆 [GitHub 倉庫](https://github.com/forfudan/decimojo) 並在本地構建包。
2726

2827
| `decimojo` | `mojo` |
2928
| ---------- | ------ |
3029
| v0.1.0 | >=25.1 |
3130
| v0.2.0 | >=25.2 |
31+
| v0.3.0 | >=25.2 |
3232

3333
## 快速入門
3434

@@ -216,7 +216,7 @@ DeciMojo 相較於 Python 的 `decimal` 模塊提供了卓越的性能,同時
216216
year = {2025},
217217
title = {DeciMojo: A fixed-point decimal arithmetic library in Mojo},
218218
url = {https://github.com/forfudan/decimojo},
219-
version = {0.2.0},
219+
version = {0.3.0},
220220
note = {Computer Software}
221221
}
222222
```

mojoproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ license = "Apache-2.0"
77
name = "decimojo"
88
platforms = ["osx-arm64", "linux-64"]
99
readme = "README.md"
10-
version = "0.2.0"
10+
version = "0.3.0"
1111

1212
[dependencies]
1313
max = "==25.2"
14-
mpmath = ">=1.3.0,<2"
1514

1615
[tasks]
1716
# format the code

0 commit comments

Comments
 (0)