Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/lib/libm/noieee_src Pull up revision 1.4 (requested by ...



details:   https://anonhg.NetBSD.org/src/rev/526108e371a7
branches:  netbsd-1-6
changeset: 527950:526108e371a7
user:      lukem <lukem%NetBSD.org@localhost>
date:      Tue Jun 18 13:39:12 2002 +0000

description:
Pull up revision 1.4 (requested by matt in ticket #286):
Ansify libm noieeesrc (for VAX).  Also make const data really const.
libm for VAX can compiles with WARNS=2

diffstat:

 lib/libm/noieee_src/n_floor.c |  12 +++++-------
 lib/libm/noieee_src/n_fmod.c  |  15 +++++++--------
 lib/libm/noieee_src/n_gamma.c |  33 +++++++++++++++------------------
 3 files changed, 27 insertions(+), 33 deletions(-)

diffs (197 lines):

diff -r ae8c1d779743 -r 526108e371a7 lib/libm/noieee_src/n_floor.c
--- a/lib/libm/noieee_src/n_floor.c     Tue Jun 18 13:38:54 2002 +0000
+++ b/lib/libm/noieee_src/n_floor.c     Tue Jun 18 13:39:12 2002 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: n_floor.c,v 1.3 1998/10/20 02:26:11 matt Exp $ */
+/*      $NetBSD: n_floor.c,v 1.3.12.1 2002/06/18 13:39:12 lukem Exp $ */
 /*
  * Copyright (c) 1985, 1993
  *     The Regents of the University of California.  All rights reserved.
@@ -38,6 +38,7 @@
 #endif
 #endif /* not lint */
 
+#define _LIBM_STATIC
 #include "mathimpl.h"
 
 vc(L, 4503599627370496.0E0 ,0000,5c00,0000,0000, 55, 1.0) /* 2**55 */
@@ -56,8 +57,7 @@
  *     customary for IEEE 754.  No other signal can be emitted.
  */
 double
-floor(x)
-double x;
+floor(double x)
 {
        volatile double y;
 
@@ -77,8 +77,7 @@
 }
 
 double
-ceil(x)
-double x;
+ceil(double x)
 {
        volatile double y;
 
@@ -120,8 +119,7 @@
  *     customary for IEEE 754.  No other signal can be emitted.
  */
 double
-rint(x)
-double x;
+rint(double x)
 {
        double s;
        volatile double t;
diff -r ae8c1d779743 -r 526108e371a7 lib/libm/noieee_src/n_fmod.c
--- a/lib/libm/noieee_src/n_fmod.c      Tue Jun 18 13:38:54 2002 +0000
+++ b/lib/libm/noieee_src/n_fmod.c      Tue Jun 18 13:39:12 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: n_fmod.c,v 1.3 1998/10/20 02:26:11 matt Exp $  */
+/*     $NetBSD: n_fmod.c,v 1.3.12.1 2002/06/18 13:39:21 lukem Exp $    */
 /*
  * Copyright (c) 1989, 1993
  *     The Regents of the University of California.  All rights reserved.
@@ -72,12 +72,11 @@
 
 #ifdef TEST_FMOD
 static double
-_fmod(x,y)
+_fmod(double x, double y)
 #else  /* TEST_FMOD */
 double
-fmod(x,y)
+fmod(double x, double y)
 #endif /* TEST_FMOD */
-double x,y;
 {
        int ir,iy;
        double r,w;
@@ -110,8 +109,7 @@
 static int nfail = 0;
 
 static void
-doit(x,y)
-double x,y;
+doit(double x, double y)
 {
        double ro = fmod(x,y),rn = _fmod(x,y);
        if (ro != rn) {
@@ -123,9 +121,10 @@
        }
 }
 
-main()
+int
+main(int argc, char **argv)
 {
-       register int i,cases;
+       int i,cases;
        double x,y;
 
        srandom(12345);
diff -r ae8c1d779743 -r 526108e371a7 lib/libm/noieee_src/n_gamma.c
--- a/lib/libm/noieee_src/n_gamma.c     Tue Jun 18 13:38:54 2002 +0000
+++ b/lib/libm/noieee_src/n_gamma.c     Tue Jun 18 13:39:12 2002 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: n_gamma.c,v 1.3 1998/10/20 02:26:11 matt Exp $ */
+/*      $NetBSD: n_gamma.c,v 1.3.12.1 2002/06/18 13:39:31 lukem Exp $ */
 /*-
  * Copyright (c) 1992, 1993
  *     The Regents of the University of California.  All rights reserved.
@@ -79,11 +79,11 @@
  *     Maximum observed error < 4ulp in 1,000,000 trials.
  */
 
-static double neg_gam __P((double));
-static double small_gam __P((double));
-static double smaller_gam __P((double));
-static struct Double large_gam __P((double));
-static struct Double ratfun_gam __P((double, double));
+static double neg_gam (double);
+static double small_gam (double);
+static double smaller_gam (double);
+static struct Double large_gam (double);
+static struct Double ratfun_gam (double, double);
 
 /*
  * Rational approximation, A0 + x*x*P(x)/Q(x), on the interval
@@ -124,7 +124,6 @@
 #define Pa7    -1.44705562421428915453880392761e-02
 
 static const double zero = 0., one = 1.0, tiny = 1e-300;
-static int endian;
 /*
  * TRUNC sets trailing bits in a floating-point number to zero.
  * is a temporary variable.
@@ -133,6 +132,7 @@
 #define _IEEE          0
 #define TRUNC(x)       x = (double) (float) (x)
 #else
+static int endian;
 #define _IEEE          1
 #define TRUNC(x)       *(((int *) &x) + endian) &= 0xf8000000
 #define infnan(x)      0.0
@@ -144,7 +144,9 @@
 {
        double b;
        struct Double u;
-       endian = (*(int *) &one) ? 1 : 0;
+#if _IEEE
+       int endian = (*(int *) &one) ? 1 : 0;
+#endif
 
        if (x >= 6) {
                if(x > 171.63)
@@ -174,8 +176,7 @@
  * Accurate to max(ulp(1/128) absolute, 2^-66 relative) error.
  */
 static struct Double
-large_gam(x)
-       double x;
+large_gam(double x)
 {
        double z, p;
        struct Double t, u, v;
@@ -203,8 +204,7 @@
  * It also has correct monotonicity.
  */
 static double
-small_gam(x)
-       double x;
+small_gam(double x)
 {
        double y, ym1, t;
        struct Double yy, r;
@@ -237,8 +237,7 @@
  * Good on (0, 1+x0+LEFT].  Accurate to 1ulp.
  */
 static double
-smaller_gam(x)
-       double x;
+smaller_gam(double x)
 {
        double t, d;
        struct Double r, xx;
@@ -266,8 +265,7 @@
  * returns (z+c)^2 * P(z)/Q(z) + a0
  */
 static struct Double
-ratfun_gam(z, c)
-       double z, c;
+ratfun_gam(double z, double c)
 {
        double p, q;
        struct Double r, t;
@@ -293,8 +291,7 @@
 }
 
 static double
-neg_gam(x)
-       double x;
+neg_gam(double x)
 {
        int sgn = 1;
        struct Double lg, lsine;



Home | Main Index | Thread Index | Old Index