[comp.bugs.4bsd] Bc Math Library Bug

steve@gec-mi-at.co.uk (Steve Lademann) (11/11/88)

Description: The `a' function (arctangent) of the math library for
             bc supplied with 4.3BSD doesn't work properly.

Repeat by:   Run bc with the libaray switch (`bc -l') and try any argument
             to the `a' function. It always gives the same result! e.g.

             a(1)
             .7853981633...
             a(.2)
             .7853981633...

Fix:         Apply the following patch to the library /usr/lib/lib.b and
             /usr/src/usr.lib/lib.b

*** /usr/lib/lib.b.old	Fri Nov 11 09:52:20 1988
--- /usr/lib/lib.b	Fri Nov 11 09:53:55 1988
***************
*** 125,133 ****
  define a(x){
  	auto a, b, c, d, e, f, g, s, t
  	if(x==0) return(0)
! 	if(x==1)
! 		if(scale<52)
  return(.7853981633974483096156608458198757210492923498437764/1)
  	t = scale
  	f=1
  	while(x > .5){
--- 125,133 ----
  define a(x){
  	auto a, b, c, d, e, f, g, s, t
  	if(x==0) return(0)
! 	if(x==1) if(scale<52) {
  return(.7853981633974483096156608458198757210492923498437764/1)
+ }
  	t = scale
  	f=1
  	while(x > .5){


Steve Lademann          |Phone: 44 727 59292 x4326
Marconi Instruments Ltd |UUCP : ...mcvax!ukc!hrc63!miduet!steve
St. Albans    AL4 0JN   |     : ...mcvax!ukc!root44!miduet!steve
Herts.   UK             |NRS  : steve@uk.co.gec-mi-at