Message-Id: <199809151609.SAA39452@ieva06.lanet.lv> From: "Andris Pavenis" To: DJGPP Workers List , Laszlo Molnar Date: Tue, 15 Sep 1998 18:14:10 +0300 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: libm.a problem in latest alpha(s) In-reply-to: <19980914001056.A169@mail.datanet.hu> Precedence: bulk Date sent: Mon, 14 Sep 1998 00:10:56 +0200 From: Laszlo Molnar Subject: libm.a problem in latest alpha(s) > Hello Workers! > > I've found a problem in the latest libm.a while testing perl 5.005_02. > Perl fails on two of its tests when I link it with djdev202a (980726+), > but it works with the plain old djdev201. The two failed tests came > from t/lib/complex.t (which contains 1000+ tests): > > not ok 975 > # 'acoth $z0' expected: '0.14694666622553-0.2318238045004i' > got: '0.14694666622553-0.270209750135292i' > for z = ( 2, 3) > not ok 978 > # 'acoth $z0' expected: '0.14694666622553+0.2318238045004i' > got: '0.14694666622553+0.270209750135292i' > for z = ( 2,-3) > > The imaginary parts seem to be very unaccurate. Any idea? > > ps: Perl uses the following formula to compute acoth: > acoth(z) = 1/2 log((1+z) / (z-1)) > atan2() is broken (or more exactly __iee754_atan2 (in src/libm/math/e-atan2.c) that is called by atan2). However these are only values I found such problem appears. Who knows if there are some more ... Here is an example: #include #include int main (void) { double s=-0.6, c=1.2; double x=atan2(s,c) , r=hypot(s,c); double s1=r*sin(x) , c1=r*cos(x); printf ("%15.10f %15.10f %15.10f\n",s,c,x); printf ("%15.10f %15.10f\n",s1,c1); return 0; }