### 4 releases

0.9.3 | May 22, 2019 |
---|---|

0.9.2 | May 14, 2019 |

0.9.1 | May 5, 2019 |

0.9.0 | Apr 29, 2019 |

#**204** in #math

**79** downloads per month

Used in rclc

**MIT**license

130KB

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`

#### Dependencies

~2.5MB

~58K SLoC