Subject: Re: PERL and NetBSD 1.3_ALPHA
To: Giles Lean <giles@nemeton.com.au>
From: Erik Bertelsen <erik@sockdev.uni-c.dk>
List: current-users
Date: 11/11/1997 10:19:46
On Tue, 11 Nov 1997, Giles Lean wrote:

.. 
.. OK, I've now got some C code with a wrong answer.  I'll send-pr
.. this later unless someone tells me it is obviously off the wall.
.. 
.. 	#include <math.h>
.. 	#include <stdio.h>
.. 	#include <stdlib.h>
.. 
.. 	int
.. 	main()
.. 	{
.. 		printf("%.15f\n", atan2(1, 1.2));
.. 		exit(0);
.. 	}
.. 
.. This code produces:
.. 
.. 0.785398163397448 on 1.3_ALPHA with the broken library
.. 0.694738276196703 on 1.1


You've got it, Giles !

Running this program on my NetBSD/i386-1.3_ALPHA gives

49 ./a.out 
0.785398163397448
49 ./a.out 
0.694738276196703
49 

(49 is the command prompt)

Between the two calls of a.out, I reinstalled libm in a version, where I
reverted the change in line 78 made in October, i.e. by removing
the () that was added to silence the compiler with WARNS=1.

49 cvs diff -r 1.1.1.1 e_atan2.c 
Index: e_atan2.c
===================================================================
RCS file: /sw/cvs-base/src/lib/libm/src/e_atan2.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.2
diff -r1.1.1.1 -r1.1.1.2
12a13
> #include <sys/cdefs.h>
14c15
< static char rcsid[] = "$NetBSD: e_atan2.c,v 1.8 1995/05/10 20:44:51 jtc
Exp $";
---
> __RCSID("$NetBSD: e_atan2.c,v 1.9 1997/10/09 11:28:40 lukem Exp $");
77c78
<       if((hx-0x3ff00000|lx)==0) return atan(y);   /* x=1.0 */
---
>       if((hx-(0x3ff00000|lx))==0) return atan(y);   /* x=1.0 */



What's lukem's (and others) opinion -- should it really be

         if (((hx-0x3ff00000)|lx)==0) return atan(y);


And finally: with the 1.8 version of line 77 in e_atan2.c,
perl passes all tests.

- Erik