I want to compute an average with 3 decimal figures, rounded to nearest, using bc.
bc
For example:
average of 3, 3 and 5 should yiel
Next function round argument 'x' to 'd' digits:
define r(x, d) { auto r, s if(0 > x) { return -r(-x, d) } r = x + 0.5*10^-d s = scale scale = d r = r*10/10 scale = s return r }