www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/09/15/11:14:38

Message-Id: <199809151609.SAA39452@ieva06.lanet.lv>
From: "Andris Pavenis" <pavenis AT lanet DOT lv>
To: DJGPP Workers List <djgpp-workers AT delorie DOT com>,
Laszlo Molnar <ml1050 AT mail DOT datanet DOT hu>
Date: Tue, 15 Sep 1998 18:14:10 +0300
MIME-Version: 1.0
Subject: Re: libm.a problem in latest alpha(s)
In-reply-to: <19980914001056.A169@mail.datanet.hu>

Date sent:      	Mon, 14 Sep 1998 00:10:56 +0200
From:           	Laszlo Molnar <ml1050 AT mail DOT datanet DOT hu>
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 <math.h>
#include <stdio.h>

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;
  }

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019