### 8 releases (1 stable)

1.0.0 | Jul 14, 2021 |
---|---|

0.9.7 | Jul 2, 2021 |

0.9.4 | Jun 30, 2021 |

0.9.3 | May 22, 2019 |

0.9.0 | Apr 29, 2019 |

#**1016** in Algorithms

**51** downloads per month

Used in **2** crates

**MIT**license

135KB

3K
SLoC

## What is it

Mathematical expression evaluation library with big integers, floats, common fractions, and complex numbers support. The library is used by the project RionaCalc

## Features

- Automatic selection of more appropriate argument type for a function: e.g,

converts float number`sqrt``(``-``4``)`

into complex one`-``4`

and then calculates the result`-``4``+`0i

. The same is true for calculating logarithm for negative float numbers, and acos and asin for argument greater than`0``+`2i`1.``0` - Automatic adding multiplication sign where it is omitted: e.g,

is calculated as`(``1``+``2``)``(``2``+``9``)``(``1``+``2``)``*``(``2``+``9``)` - Functions with a single-value argument do not require to enclose its argument into brackets: e.g,

is calculated as`sin cos``2``sin``(``cos``(``2``)``)` - The final closing brackets can be omitted: e.g,

is the same as`(``1``+``2``)``*``(``2``+``9``(``1``+``2``)``*``(``2``+``9``)` - Trigonometric functions work with radians and degrees. Bare numbers are treated as radians, degrees requires one or three suffixes. Two degrees formats:

or`20d30m50s`

. Minutes and seconds can be omitted, in this case degrees can be float number like`20`°`30``'``50``"`

. So,`30.``25`d

==`sin``(`pi`/``2``)``sin``(``90`°`)` - Every number can include group separator

for readability - it is very useful when using big integers.`_`

==`3_000.``90_23``3000.``9023` - Both

and`.`

are treated as decimal separators`,` - Function argument separator is

. If a function receives more arguments than it requires, the trailing arguments are dropped: e.g,`;`

is the same as`sqrt``(``11``;``12``;``13``)``sqrt``(``11``)` - Regular fractions use

to separate its parts. They can be written with integer part or only with numerator and denominator, e.g`\`

==`1`\`1`\`10``11`\`10` - Two complex numbers formats: with marker at the end or in the middle. E.g,

==`1``+`2i

. In addition,`1``+`i2

can be used instead of`j`

- but the calculator outputs always with`i``i` - Hexadecimal(starts with

), octal(starts with`0x`

), and binary(starts with`0o`

) numbers`0b` - Character

can be either a modulo or a percentage operator. It depends on the character position: if`%`

is right before the expression end or before closing bracket or before another operator`%`*and*previous operator is one of

,`+`

,`-`

, or`*`

, the character is considered a percentage operator`/`

#### Dependencies

~3.5MB

~76K SLoC