[comp.bugs.4bsd] a

katsu@srava.sra.JUNET (Katsuhiro Watanabe) (10/09/89)

Subject: a(x) of `bc -l' on 4.3BSD makes incorrect output.
Index:	usr.lib/lib.b 4.3BSD

Description:
	Function a(x) (arctan) of `bc -l' returns
		0			(when x == 0)
		.78539816339744830961	(when x != 0)
	The bug is in `/usr/lib/lib.b'. It is working correctly on 4.2BSD,
	but not on the 4.3BSD.

Repeat-By:
	bc -l
	a(0.00000001)

Fix:
	Apply the following patch. (then you will get the same lib.b (4.2BSD) 
	as before. What the revision on 4.3BSD for? 
	To insert the Bug in it only! Absurd....)

-------------------------- CUT HERE -----------------------
*** lib.b.orig	Tue Dec  6 19:27:41 1988
--- lib.b	Mon Oct  9 11:49:08 1989
***************
*** 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,135 ----
  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){
-------------------------- CUT HERE -----------------------

----____----____
WATANABE Katsuhiro
Software Tools and Technology Division, SRA Inc. JAPAN.
Not execute f(x), but evaluate it.