Код: Выделить всё
echo "56.8 + 77.7" | bcКод: Выделить всё
echo "obase=16; ibase=10; 56" | bcTo perform division is a bit tricky, because the will result usually in floating point. Therefore in order to get the correct answer, you need to specified scale. scale means the precision of floating point, how many digit after the point. By default the scale is 0, that means it is integer.
5.00500 – the scale is 5
5.005 – the scale is 3
So the example :
Код: Выделить всё
echo "scale=6; 60/7.02" | bc