Firstly, trying to do floating point arithmetic with bc(1) without using the -l flag should give you some funny answers:
sarnold@haig :~$ bc -q 3.5 * 3.5 12.2 sarnold@haig :~$ bc -q -l 3.5 * 3.5 12.25
Secondly, $((...)) is an attempt to perform arithmetic in your shell; neither my bash nor dash can handle floating point numbers.
If you want to do arithmetic in your shell, pay attention to printf(1) , as well as (possibly) the built-in printf shell function. If you want to do arithmetic in bc, pay attention to the special variable scale .
sarnold
source share