On Mon, Jul 13, 2020 at 01:41:39PM +0200, Klaus Singvogel wrote: > rhkra...@gmail.com wrote: > > > > From the command line: bc -l (the -l doesn't something useful (to me) but I > > forget what ;-) > > I'm using "bc -l" either. > > "-l" is including the math lib, for functions like exp, sin, cos, etc.
This is correct. The -l *also* sets the bc "scale" variable to 20, meaning it calculates non-integer values to 20 decimal places. Using such a high precision is extremely important with certain calculations, where using lower precision values would cause severe rounding errors, which would accumulate and worsen quite dramatically. unicorn:~$ echo 'e(1.4*l(500))' | bc -l 6005.62216990715616614180 unicorn:~$ echo 'scale=2; e(1.4*l(500))' | bc -l 5943.18 Never set a low scale value in bc. If you don't want to see 20 digits after the decimal place, perform rounding in a separate step. unicorn:~$ printf '%.2f\n' "$(echo 'e(1.4*l(500))' | bc -l)" 6005.62