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

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` |
| type | alias | information | internal representation |
| ------------ | ------- | ------------------------------------ | ----------------------------------- |
| `BigUInt` | `BUInt` | arbitrary-precision unsigned integer | `List[UInt32]` |
| `BigInt` | `BInt` | arbitrary-precision integer | `BigUInt`, `Bool` |
| `Decimal` | `Dec` | 128-bit fixed-precision decimal | `UInt32`,`UInt32`,`UInt32`,`UInt32` |
| `BigDecimal` | `BDec` | arbitrary-precision decimal | `BigUInt`, `Int`, `Bool` |

## Installation

Expand Down
5 changes: 5 additions & 0 deletions benches/bigdecimal/bench.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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
from bench_bigdecimal_divide import main as bench_divide
from bench_bigdecimal_sqrt import main as bench_sqrt
from bench_bigdecimal_scale_up_by_power_of_10 import main as bench_scale_up


Expand All @@ -15,6 +16,7 @@ add: Add
sub: Subtract
mul: Multiply
div: Divide (true divide)
sqrt: Square root
all: Run all benchmarks
q: Exit
=========================================
Expand All @@ -31,11 +33,14 @@ scaleup: Scale up by power of 10
bench_multiply()
elif command == "div":
bench_divide()
elif command == "sqrt":
bench_sqrt()
elif command == "all":
bench_add()
bench_sub()
bench_multiply()
bench_divide()
bench_sqrt()
elif command == "q":
return
elif command == "scaleup":
Expand Down
Loading