Thread View: net.bugs
2 messages
2 total messages
Started by Robert Herndon
Wed, 01 Feb 1984 02:00
Prehistoric BC Bug - (nf)
Author: Robert Herndon
Date: Wed, 01 Feb 1984 02:00
Date: Wed, 01 Feb 1984 02:00
32 lines
1391 bytes
1391 bytes
#N:umn-cs:1300001:000:745
umn-cs!herndon Jan 31 17:59:00 1984
There is a bug in the BC library. The arc-tangent function ("a")
returns pi/4 for the arctangent of any non-zero number. The cause
of this is a mis-associated "if" statement in the function definition.
The fix for this is to change the definition of the a() function.
The file currently reads:
125a126,128
> if(x==1)
> if(scale<52)
> return(.7853981633974483096156608458198757210492923498437764/1)
The following may be substituted:
126,130d125
> if(x==1) {
> if(scale<52) {
> return(.7853981633974483096156608458198757210492923498437764/1)
> }
> }
Or the lines may be deleted entirely. This will slow down the
evaluation of a(1) substantially but will not otherwise harm the
function.
Robert Herndon
umn-cs!herndon
Re: Prehistoric BC Bug - (nf)
Author: D.C.Wood
Date: Fri, 03 Feb 1984 10:44
Date: Fri, 03 Feb 1984 10:44
27 lines
1448 bytes
1448 bytes
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@ukc.UUCP ...!vax135!ukc!dcw
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads