Find a file
Louis Rubet c4bad49c59 v2.5
2022-09-22 16:04:59 +02:00
.github/workflows github action to ubuntu 22.04 2022-09-22 10:56:07 +02:00
doc v2.4.0-generation 2022-02-28 17:39:13 +01:00
linenoise-ng@9d4c52c1cc Correct benign clang warnings 2022-09-22 11:41:58 +02:00
mpreal@269a03782f \#277 Set mpfr submodule to version mpfr++-3.6.9 2022-09-22 12:00:31 +02:00
src #273 don't show stack after errors 2022-09-22 15:36:36 +02:00
test endl test 2022-03-31 10:57:56 +02:00
.gitignore Add debug and release dirs in .gitignore 2022-02-22 16:35:05 +01:00
.gitmodules github action for tests 2022-02-23 16:59:37 +01:00
CHANGELOG.md v2.5 2022-09-22 16:04:59 +02:00
CMakeLists.txt Correct benign clang warnings 2022-09-22 11:41:58 +02:00
LICENSE #35: CMake 2017-06-10 18:44:51 +02:00
MANUAL.md Change date, time, ticks, remove nop, add welcome 2022-03-02 15:08:57 +01:00
README.md Change date, time, ticks, remove nop, add welcome 2022-03-02 15:08:57 +01:00

rpn - Reverse Polish Notation CLI calculator License: LGPLv3

A math functional language using reverse (postfix) polish notation

rpn> 1 2 +
3
rpn> 2 sqrt
2> 3
1> 1.4142135623730950488016887242096980786

Manipulating reals, complexes, strings, symbols on a stack

rpn> 1 2 + 2
2> 3
1> 2
rpn> r->c sq conj (1,1) /
(-3.5,-8.5)
rpn> 0x1234 dec
4660
rpn> bin
0b1001000110100
rpn> 4 fix "sqrt of 2 is about " 2 sqrt ->str +
"sqrt of 2 is about 1.4142"
rpn> << -> x << x 3 ^ 2 x * - 3 + >> >> 'f' sto
rpn> 2 f
7
rpn> (1,2) f
(-10,-6)

Arbitrary precision

rpn> 256 prec
rpn> pi
3.1415926535897932384626433832795028841971693993751058209749445923078164062862
rpn>

Variables, structured programming

rpn> 0 1 10000 for i i sq + next
333383335000
rpn> a 1 > if then a sq 'calc' eval else 'stop' eval end
rpn> << dup
>  1 > if then
>    dup 1 - fibo swap 2 - fibo +
>  else
>    1 == 1 0 ifte
>  end >>
>'fibo' sto
rpn> 12 fibo
144

Available functions

rpn> 
Display all 145 possibilities? (y or n)
help     sqrt     arg      <=       depth    ift      ->       log2
h        sq       c->r     !=       roll     ifte     pi       alog2
?        abs      r->c     ==       rolld    do       sin      exp2
quit     sign     p->r     and      over     until    asin     sinh
q        %        r->p     or       ->str    while    cos      asinh
exit     %CH      std      xor      str->    repeat   acos     cosh
test     mod      fix      not      chr      sto      tan      acosh
version  fact     sci      same     num      rcl      atan     tanh
uname    mant     prec     swap     size     purge    d->r     atanh
history  xpon     round    drop     pos      vars     r->d     time
+        floor    default  drop2    sub      clusr    e        date
-        ceil     type     dropn    if       edit     ln       ticks
*        ip       hex      del      then     sto+     log
/        fp       dec      erase    else     sto-     lnp1
inv      min      bin      rot      end      sto*     exp
chs      max      base     dup      start    sto/     expm
neg      re       >        dup2     for      sneg     log10
^        im       >=       dupn     next     sinv     alog10
pow      conj     <        pick     step     eval     exp10

Download

Available as source code and flatpak under flathub (coming soon).

Manual

A reference manual is provided here

Generation

rpn is written in C++ and is dynamically linked to GNU MP and GNU MPFR. It integrates linenoise-ng and mpreal source code as git submodules.

It can be generated following the steps below:

Generate and install under Ubuntu 20.04 LTS and superior

sudo apt install git cmake g++ libmpfr6 libmpfr-dev
git clone https://github.com/louisrubet/rpn/ 
mkdir -p rpn/build && cd rpn/build
cmake ..
make -j
sudo make install

Generate and install under Fedora 35

sudo dnf install git cmake g++ mpfr mpfr-devel
git clone https://github.com/louisrubet/rpn/ 
mkdir -p rpn/build && cd rpn/build
cmake ..
make -j
sudo make install

Contact, contribution, bug report

Please email me at louis@rubet.fr

You can also use github issues and pull requests