bc is ignoring scale option bc is ignoring scale option bash bash

bc is ignoring scale option


as Carl pointed out, if you check man page, you can find that line. it is about expression explanations. subtraction won't read scale variable. If you want to get the expected result (1.30), you could:

kent$  echo 'scale=2; (2.777 - 1.4744)/1' | bc 1.30

/ operation will read scale variable.


From the bc(1) man page:

Unless specifically mentioned the scale of the result is the maximum scale of the expressions involved.

1.4744 has scale 4, so that's what happens to your expression.