### 1 unstable release

0.1.0 | Nov 14, 2023 |
---|

#**2256** in Command line utilities

**31** downloads per month

**AGPL-3.0**

92KB

703 lines

# roundme

is an experimental human-assisted rounding analyzer. It aims to provide recommendations to determine if an arithmetic operation should round up or down`roundme`

## Install

Install with

`cargo`` install roundme`

To install the latest github version

`git`` clone git@github.com:crytic/roundme.git`
`cd`` roundme`
`cargo`` install`` --`path .

## How to use

- Run

to generate a default configuration file.`roundme init` - Run

to generate user configuration file.`roundme config` - Run

to analyze the configuration file`roundme analyze` - Run

to generate a PDF (require`roundme pdf`

)`latexmk`

Running

on the default configuration will generate the following:
`roundme pdf`

### Configuration

relies on a configuration file:`roundme`

`formula``:` `a * b / c`
`round_up``:` `true`
`less_than_one``:` `[``"`a * b`"``]` `#` optional
`greater_than_one``:` `[``"`c`"``]` `#` optional

contains the formula to be analyze`formula`

determines if the result of the formula should round up or down`round_up`

is used for the`less_than_one`

rules`*``*`*(raw string comparison and sensible to space)*

is used for the`greater_than_one`

rules`*``*`*(raw string comparison and sensible to space)*

See the balancer V2 example.

## Features

- Recommend what arithemic operation needs to round up or down
- Generate latex-based report in PDF

## Rules

is the expected rounding direction for the result (up or down)`rounding``(``)`

(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`)`

(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`=>``rounding``(`A`)``,``!``rounding``(`B`)``,``rounding``(``/``)``A``*``*`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)`If``A``<`1 =`>``rounding``(`A`)``,``!``rounding``(`B`)`

#### Dependencies

~5.5–8.5MB

~149K SLoC