Simple CLI math expression evaluator.
mm uses repl to interact with user with live results and error highlighting, but immediate mode is also supported.
Install using go install:
go install github.com/mymmrac/mm@latestNote: Make sure to add
$GOPATH/bininto$PATH
Start repl and type some expressions:
mm
> 1 + 1
> 2 ^ 8 / 3.1
> 1 / ceil(2.5 + 4 / (abs(sin(5))))Enter- evaluate expressionUp,Tab- previews executed expressionDown,Shift+Tab- next executed expressionShift+Tab- use the result of last expression as input (only if input empty)Esc- exit if input is empty, or clean inputCrtl+c- force quit
+Addition-Subtraction*Multiplication/Division//Floor division^Power%Modulo
+Plus-Minus
sqrt/1Square rootabs/1Absolute valueround/1Round to integerround/2Round with precisionroundUp/1Round up to integerroundUp/2Round up with precisionfloor/1Floorceil/1Ceilsin/1Sinecos/1Cosinetan/1Tangentatan/1Arc tangentrad/1To radiansmin/2Minimummax/2Maximumrand/0Random value [0, 1)
Note:
<name>/Nmeans that<name>is called withNarguments
Pi- 3.1415926...e- 2.7182818...
mm is distributed under MIT licence.