Crates.io | roundme |
lib.rs | roundme |
version | 0.1.0 |
source | src |
created_at | 2023-11-14 07:15:38.436532 |
updated_at | 2023-11-14 07:15:38.436532 |
description | Rounding analyzer |
homepage | |
repository | https://serde.rs/ |
max_upload_size | |
id | 1034448 |
size | 208,504 |
roundme
is an experimental human-assisted rounding analyzer. It aims to provide recommendations to determine if an arithmetic operation should round up or down
Install with
cargo install roundme
To install the latest github version
git clone git@github.com:crytic/roundme.git
cd roundme
cargo install --path .
Run roundme init
to generate a default configuration file.
Run roundme config
to generate user configuration file.
Run roundme analyze
to analyze the configuration file
Run roundme pdf
to generate a PDF (require latexmk
)
Running roundme pdf
on the default configuration will generate the following:
roundme
relies on a configuration file:
formula: a * b / c
round_up: true
less_than_one: ["a * b"] # optional
greater_than_one: ["c"] # optional
formula
contains the formula to be analyze
round_up
determines if the result of the formula should round up or down
less_than_one
is used for the **
rules (raw string comparison and sensible to space)
greater_than_one
is used for the **
rules (raw string comparison and sensible to space)
See the balancer V2 example.
Recommend what arithemic operation needs to round up or down
Generate latex-based report in PDF
rounding()
is the expected rounding direction for the result (up or down)
A + B => rounding(A), rounding(B)
(addition does not change the rounding direction)A - B => rounding(A), ! rounding(B)
(the rounding direction of the substracted element is inverse of the expected rounding)A * B => rounding(A), rounding(B), rounding(*)
(multiplication does not change the rounding direction)A / B => rounding(A), ! rounding(B), rounding(/)
(the rounding direction of the denominator is the inverse of the expected rounding)A ** B
If A>=1 => rounding(A), rounding(B)
If A<1 => rounding(A), ! rounding(B)
(if A is below 1, the rounding direction of the exponent is the inverse of the expected rounding)