Commit 2f1bdb3
authored
[decimal] Implement the
This pull request adds support for a new `quantize` function across
various files and updates dependencies. The most important changes
include the addition of the `quantize` function, updates to the
`mojoproject.toml` file, and the inclusion of new benchmarks and tests.
### Addition of `quantize` function:
* `src/decimojo/decimal.mojo`: Added the `quantize` method to the
`Decimal` struct to allow quantizing a `Decimal` to a specified
exponent.
* `src/decimojo/rounding.mojo`: Implemented the `quantize` function,
which rounds a value according to the exponent of the second operand.
### Updates to `mojoproject.toml`:
* `mojoproject.toml`: Added the `max` dependency and included
`test_quantize` and `bench_quantize` tasks.
### Inclusion of new benchmarks and tests:
* `benches/bench.mojo`: Added `bench_quantize` to the list of
benchmarks.
* `src/decimojo/__init__.mojo`: Updated imports to include the new
`quantize` function.quantize() function (#44)1 parent d9f52a0 commit 2f1bdb3
File tree
7 files changed
+1165
-20
lines changed- benches
- src/decimojo
- tests
7 files changed
+1165
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
0 commit comments