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
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@ The core types are:

- 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, and trigonometric operations.
- 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.

The library is expanding to include `BigDecimal` types that support arbitrary precision[^arbitrary], allowing for calculations with unlimited digits and decimal places. These extensions are currently under active development.
- An arbitrary-precision decimal implementation `BigDecimal` allowing for calculations with unlimited digits and decimal places[^arbitrary]. It is currently under active development.

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.

| type | information | internal representation |
| ------------ | ------------------------------------ | ------------------------ |
| `BigUInt` | arbitrary-precision unsigned integer | `List[UInt32]` |
| `BigInt` | arbitrary-precision integer | `BigUInt`, `Bool` |
| `Decimal` | 128-bit fixed-precision decimal | 4 `UInt32` words |
| `BigDecimal` | arbitrary-precision decimal | `BigUInt`, `Int`, `Bool` |

## Installation

DeciMojo is available in the [modular-community](https://repo.prefix.dev/modular-community) package repository. You can install it using any of these methods:
Expand Down
5 changes: 5 additions & 0 deletions benches/bigdecimal/bench.mojo
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from bench_bigdecimal_add import main as bench_add
from bench_bigdecimal_subtract import main as bench_sub
from bench_bigdecimal_multiply import main as bench_multiply


fn main() raises:
Expand All @@ -10,6 +11,7 @@ This is the BigInt Benchmarks
=========================================
add: Add
sub: Subtract
mul: Multiply
all: Run all benchmarks
q: Exit
=========================================
Expand All @@ -20,9 +22,12 @@ q: Exit
bench_add()
elif command == "sub":
bench_sub()
elif command == "mul":
bench_multiply()
elif command == "all":
bench_add()
bench_sub()
bench_multiply()
elif command == "q":
return
else:
Expand Down
Loading