I use qalculate as my day-to-day calculator and it's great! It is easy enough to type in something like:
(1+10^(-17.2/20)) / (1-10^(-17.2/20))
and get the right answer:
1.320289
But trying to get bc to do this sort of calculation in a bash script is frustrating. Google search spits back many pages demonstrating the simplest kinds of simple math examples using bc, but I have yet to find any pages tackling how to perform more complex calculations. When I type the following at CL:
echo 'scale=50; (1+10^(-17.2/20)) / (1-10^(-17.2/20))' | bc -l
I get the following warning-errors:
Runtime warning (func=(main), adr=25): non-zero scale in exponent
Runtime warning (func=(main), adr=44): non-zero scale in exponent
Runtime error (func=(main), adr=46): Divide by zero
If I try something similar but a little simpler like:
echo '(1-10^(-17.2/20))' | bc -l
I do get an answer, buts it's wrong and comes complete with a warning.
Runtime warning (func=(main), adr=18): non-zero scale in exponent
0
What could bc be having trouble with here, or rather what am I not doing correctly to get bc to perform these calculations properly?