Show HN: Calc – A fast and intuitive command-line calculator written in Go
github.com
github.com
http://www.isthe.com/chongo/tech/comp/calc
It is very powerful, has history, shows previous calculations, and it's pretty darn quick too.
Of course, there are plenty more calculators, powerful too. I only mention calc because it bothers me that the name of this new project collides with it, without really providing anything useful beyond having been written in a fashionable language.
The project name was originally calc.go, but as you can imagine that didn't work out too well with `go get`.
$ echo "1/2" | bc
0
$ echo "1/2" | bc -l
.50000000000000000000
$ echo "scale=1; 1/2" | bc
.5
$ echo "1/2" | calc -p
0.5
$ echo "+1+1+1+1" | bc -l
(standard_in) 1: syntax error
$ echo "+1+1+1+1" | calc -p
4
$ echo "sqrt(-1)" | bc -l
Runtime error (func=(main), adr=4): Square root of a negative number
$ echo "sqrt(-1)" | calc -p
1i
$ echo "s(pi)" | bc -l
0
$ echo "sin(pi())" | calc -p
0 $ bc -l <<< "1+1"-> √7×2÷π−ε0×σ+α+γ+R∞×Mτ-Φ0 = 2.26885
without really providing anything useful beyond having been written in a fashionable language
The latter part of your comment sounds a bit discouraging. I think the developer didn't mean any harm an probably didn't know about this one.
PS: The dev had replied in the thread. All is well I guess.
Two programs, same funcionality, same name. Haven't we learnt anything?
If you want to try that, the relevant code is the Evaluate function in `compute/compute.go`.
A Google search for "command line calculator" doesn't turn up much, so I honestly didn't think there were many decent ones out there (aside from dc/bc). Are there any you have in mind?
I was planning on adding a REPL-mode to it today for fun, and then someone linked me this post, saying "this could have been clac!", hehe.
https://github.com/ConceptJunkie/rpn
My rpn calculator started out comparable to the project described here, once I discovered the mpmath library, the project took on a life of its own and now has over 400 operations covering basic math, number theory, combinatorics, unit conversions (comparable to the GNU units program, or the Frink programming language), algebra and anything else that strikes my fancy.
Includes a calculator, but also a complete declarative data-processing language too.
E.g.:
$ tab "[ log(@),@ : count(5) ]"
0 1
0.693147 2
1.09861 3
1.38629 4
1.60944 5function calc { python -c "from math import *; print $1" }
https://play.google.com/store/apps/details?id=com.scaleasw.p...