You are not logged in.
Hey guys,
I'm looking for a good command-line calculator, like bc. I find bc quite limited as is (even with user-defined functions) : for example, I can't calculate logarithms for any base or powers of rational numbers (like 2^2.5). I might calculate log(x) / log(y) to get a log(x) of base y. And 2^2.5 = √2^5. But I'd like my calculator to think about it by itself
and not getting a runtime error when I try to calculate those things.
I had to emulate all of those, by creating a wrapper taking the input from the terminal, parsing it and calculating those things with my own small programs, and then giving the output to bc. But it's hardly maintainable as you imagine !
So I'm looing for a better command-line calculator, does anyone know one ? (no polish notation, it quite confuses me
)
Thanks !
Last edited by ehmicky (2012-03-08 01:01:50)
Stego++, first general-purpose steganography library ever !
Will use most-used steganographic techniques as modules, with crypto and compression support, and high-quality security features. LGPL.
Release by end 2012. Contact me if you know crypto or stego and would be interested in team working with me.
Offline
Offline
Offline
Hey,
Thanks for your replies.
calc is really great, I'm gonna use it I think, although I still need to parse the input, cause I configured my keyboard with crazy keys like √,℮,∫,ℕ or ± that calc doesn't handle ![]()
I've bumbed into another calculator called genius, which looks also awesome, with crazy things like number theory functions I have no idea what they're about ![]()
Thank you very much !
Last edited by ehmicky (2012-03-08 01:02:12)
Stego++, first general-purpose steganography library ever !
Will use most-used steganographic techniques as modules, with crypto and compression support, and high-quality security features. LGPL.
Release by end 2012. Contact me if you know crypto or stego and would be interested in team working with me.
Offline
As a devoted reverse Polish guy, How about bc or orpie ?
And then I re-read your first post ![]()
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
...
So I'm looing for a better command-line calculator, does anyone know one ? (no polish notation, it quite confuses me smile )
...
Try awk, for simple things you can write a script that passes arguments to awk, it's also faster to load than python and almost all *nix systems should have it installed which I find very useful.
To get awk to print out the results of a calcuation it should be of the following form
awk 'BEGIN{print 3/2}'You can also try this tutorial
====* -- Joke
O
\|/ --- Me
/ \ Whooooosh
Offline
Don't do that. Don't go awk. Use bc for small calculations (better alias bc="bc -l -q") and pcalc for programming stuff. If you need anything more complicated, you can always go with maxima
Thou shalt not make a machine in the likeness of a human mind
Offline
Don't do that. Don't go awk. Use bc for small calculations (better alias bc="bc -l -q") and pcalc for programming stuff. If you need anything more complicated, you can always go with maxima
I disagree, awk is more portable, and it's reasonably fast. More systems have awk than bc, dc or maxima because it is part of the uinix spec so you can be guaranteed to find awk and bash on any *nix system you work on. He also said he no longer wishes to use bc because of its limitations, awk is a good replacement for the simple command line calculations that he is interested in without having to wait for larger programs to load.
====* -- Joke
O
\|/ --- Me
/ \ Whooooosh
Offline
A bit late, but another suggestion is wcalc https://aur.archlinux.org/packages.php?ID=15219
It should do all you want, but I don't use it for anything too sophisticated, so I can't say it fulfils all your criteria.
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
cra wrote:Don't do that. Don't go awk. Use bc for small calculations (better alias bc="bc -l -q") and pcalc for programming stuff. If you need anything more complicated, you can always go with maxima
I disagree, awk is more portable, and it's reasonably fast. More systems have awk than bc, dc or maxima because it is part of the uinix spec so you can be guaranteed to find awk and bash on any *nix system you work on. He also said he no longer wishes to use bc because of its limitations, awk is a good replacement for the simple command line calculations that he is interested in without having to wait for larger programs to load.
awk yes, bash, no. I know people who work on systems without bash. [/pedantry] ![]()
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
awk yes, bash, no. I know people who work on systems without bash. [/pedantry]
Then it's either embedded systems, e.g. ash, or the default is different like tcsh on FreeBSD, but it should still be there, even on FreeBSD, unless the admin removed it deliberately. By default almost all *nix systems have bash or a bash-like shell available. The previous institute I worked in used tcsh but bash was available.
![]()
Edited for return friendly smiley face - I forget tone gets lost and short posts can sound unfriendly
Last edited by makimaki (2012-03-08 11:12:46)
====* -- Joke
O
\|/ --- Me
/ \ Whooooosh
Offline
They are large Unix systems and only have ksh available. This may be an exception (tbh I have no idea how common it may be) but it's at least two large companies involved in the systems. You're right though in that some reasonable shell will pretty much be available now, even if it's not bash per se in every case. I was just being unhelpfully pedantic (it's been a slow morning). Apologies for the digression. ![]()
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
Hi all,
Thanks for the tips. wcalc is also a good answer for my request, although it's a bit simpler/more limited that genius or calc. For example, it seems like it doesn't support complex numbers or matrix calculation.
Last edited by ehmicky (2012-03-08 12:12:21)
Stego++, first general-purpose steganography library ever !
Will use most-used steganographic techniques as modules, with crypto and compression support, and high-quality security features. LGPL.
Release by end 2012. Contact me if you know crypto or stego and would be interested in team working with me.
Offline