csq - calculator squared, or just calculator²
Fancy command-line calculator that uses fractions instead of decimal floating point numbers.
It works like any other calculator, with exception of division, which returns
a fraction. After evaluation, the result is reduced, so
21 / 7 = 3/1 = 3.
Basic line editing is also provided. Press
Ctrl+D to quit.
a + b,
a - b,
a * b,
a / b- self-explanatory
a ^ b- raises a to the power of b, b must have denominator of 1
a % b- returns the remainder from divsion of a by b, both must have denominator of 1
(expression)- sets highest precedence for expression
$N- returns the value of N-th expression
sqrt a- returns a very approximated square root of a
mixed 1|0- enables or disables mixed fraction display
$ csq (1) 21 / 7 = 3 (2) 7 / 21 = 1/3 (3) $2 * 3 = 1 (4) sqrt 64 = 8
At build time, a recent Hare toolchain is required.
$ make # make install
$ git config format.subjectPrefix "PATCH csq"