Prehistoric BC Bug - (nf)
D.C.Wood
dcw at ukc.UUCP
Fri Feb 3 20:44:41 AEST 1984
Here is a Bigger and Better Bug in Bc:
scale=99
x=sqrt(2)
x
1.414213562373095048801688724209698078569671875376948073176679737990732\
478462107038850387534327641572
x*x
199999999999999999999999999999999999999999999999999999999999999999999\
9999999999999999999999999999997921066900256462438170679779231122858093\
9665738428702231869954990504493272650132450052758957026311840./
x^2
1.999999999999999999999999999999999999999999999999999999999999999999999\
999999999999999999999999999997
Multiplication can give a relative error of 199(!) orders of magnitude
when the scale is greater than 63. Is this a record? Exponetiation gets
it right.
There may still be a bug in another bc library function - I think it was
s() (sine) - which used an undeclared variable `t'. This caused no problems
unless it was called from a program which also used `t'.
David Wood
dcw at ukc.UUCP
...!vax135!ukc!dcw
More information about the Net.bugs
mailing list