$ pi=$(echo "scale=8; 4*a(1)" | bc -l)
$ echo $pi
3.14159264
What? How did the last digit end up as '4'? That's no kind of rounding I've ever heard of!So I ran `bc` on my machine and tried:
[jeff@prism:~/path]$ bc -l
bc 1.07.1
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006, 2008, 2012-2017 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
scale=8;
4*a(1)
3.14159264
scale=16;
4*a(1)
3.1415926535897932
I guess you could say "learn bc before using it", but even after a quick skim of the man page, this is not what I would expect.