If you’re looking for a good calculator on Linux / Unix, you can use bc. bc is “an arbitrary precision calculator” supporting bignumbers and many operators … well it will mostly do whatever you want (check the fine documentation).
Anyway, about those 2 little tricks I promised :
- change the scale variable (eg : scale=10) to set “the total number of digits after the decimal point”. Defaults to 0 -> Not cool.
- use the last variable to recall the last value you computed -> Cool.
That was it ! This is what I always need and forget, so I decided to blog it once for all…
If you really don’t know bc yet, give it a try !
Update: you can start bc with a default scale of 20 by using the “-l” option on the command line … (Thanks to Luke).
Regarding the first tip – just run bc with -l:
bc -l
It puts the calculator in the floating point mode, and enables all the advanced math functions.
I use bc all the time. 🙂
Luke, thanks ! OK, I should have RTFM …this is much better than changing the scale inside of bc -> I update the post !