On Mon, Jul 13, 2020 at 09:06:17PM -0400, The Wanderer wrote: > Based on a bit more digging, apparently calc does also have an atan() > function, which produces the arctangent of its argument; atan(1)*4 gives > 3.14159265358979323848. Oddly, that last digit is not the same as what > 'bc -l' gave from '4*a(1)' in Greg's demonstration; it looks like > atan(1) gives a value which is off in the very last displayed decimal > place from what Greg gave. I suspect that there is display rounding > involved on one side or the other.
One doesn't expect the last few digits of precision to be... precise. ;-) When using bc with its default scale of 20, for most calculations you'll end up with however much precision you *actually* want (say, 5 or 6 digits) after you round the final value. It's not intended to be absolutely correct to 20 digits. It simply *uses* 20 digits in all of its intermediate calculations. As I pointed out earlier, the rounding errors accumulate.