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.

2 Comments:
passing the -l argument also put it in floating point mode
True, but then the precision would be too much for me :-)
Post a Comment