0

I have been happily using bc for a few weeks. Now I need to do some simple calculations like 1.0+27.0/37.0*5.0, which bc in interactive mode calculates as integer result. I tried this on two different linux boxes. Same result: 1 instead of 4.67...

Can you suggest an explanation?

joews
  • 29,767
  • 10
  • 79
  • 91

1 Answers1

0

Are you really using bc for several weeks? By default bc computes on integer numbers. You may change it either by typing first:

scale=8

(or whatever number of digits you need).

Or by launching bc with: bc -l which is often the most convenient way since it also loads some scientific functions.

Thomas Baruchel
  • 7,236
  • 2
  • 27
  • 46