Very often I need a simple command line calculator to do some simple math for my accounting or economics classes. Usually I don't need anything more complicated than the simple arbitrary precision calculator bc. The bc is very intuitive to use, after you learn to set the precision used in calculations:
scale=5
This sets the precision to five digits. Unless you define the precision bc will default to integer results which would not provide especially precise results. After setting the precision, bc is very intuitive to use. For example:
mjp@oikos:~$ bc
bc 1.06.94
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
scale=5
10/3
3.33333
A lot more information can be found with man bc, as usual.
3 comments:
passing the -l argument also put it in floating point mode
True, but then the precision would be too much for me :-)
I know this post is ancient but it's high in the Google results for "bc precision", so just to clarify: -l doesn't put bc in floating point mode, it sets scale=20 (and loads some trig functions).
Post a Comment