diff options
author | Martynas Venckus <martynas@cvs.openbsd.org> | 2008-06-16 21:10:31 +0000 |
---|---|---|
committer | Martynas Venckus <martynas@cvs.openbsd.org> | 2008-06-16 21:10:31 +0000 |
commit | b73c46866bf8c5c3f182801c1f255166c9f02907 (patch) | |
tree | 1822f7ad178ec05833c7cde14eb5f37c09c51644 /lib/libm | |
parent | a2a6560af51ef84eb84ec9dc5fc684893fbbd556 (diff) |
fix some errors found by lint, e.g. declaration w/o types, make
zero const. also do the same fix as was found for ieee's trunc by
lint; ok millert@. tested on VAX
Diffstat (limited to 'lib/libm')
-rw-r--r-- | lib/libm/noieee_src/n_lgamma.c | 4 | ||||
-rw-r--r-- | lib/libm/noieee_src/n_log.c | 16 | ||||
-rw-r--r-- | lib/libm/noieee_src/n_support.c | 10 | ||||
-rw-r--r-- | lib/libm/noieee_src/n_tgamma.c | 23 |
4 files changed, 32 insertions, 21 deletions
diff --git a/lib/libm/noieee_src/n_lgamma.c b/lib/libm/noieee_src/n_lgamma.c index c874e8c6ba5..b824b196cef 100644 --- a/lib/libm/noieee_src/n_lgamma.c +++ b/lib/libm/noieee_src/n_lgamma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_lgamma.c,v 1.4 2008/06/11 20:53:27 martynas Exp $ */ +/* $OpenBSD: n_lgamma.c,v 1.5 2008/06/16 21:10:30 martynas Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -140,7 +140,7 @@ lgamma(double x) { double r; - signgam = 1; + int signgam = 1; #if _IEEE endian = ((*(int *) &one)) ? 1 : 0; #endif diff --git a/lib/libm/noieee_src/n_log.c b/lib/libm/noieee_src/n_log.c index 04f4a22bacc..01abe38cc42 100644 --- a/lib/libm/noieee_src/n_log.c +++ b/lib/libm/noieee_src/n_log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_log.c,v 1.4 2008/06/11 20:53:27 martynas Exp $ */ +/* $OpenBSD: n_log.c,v 1.5 2008/06/16 21:10:30 martynas Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -414,8 +414,10 @@ log(double x) /* case 2: |1-x| < 1/256. The m- and j- dependent terms are zero; * u1 = u to 24 bits. */ - else - u1 = u, TRUNC(u1); + else { + u1 = u; + TRUNC(u1); + } u2 = (2.0*(f - F*u1) - u1*f) * g; /* u1 + u2 = 2f/(2F+f) to extra precision. */ @@ -437,7 +439,7 @@ struct Double __log__D(double x) { int m, j; - double F, f, g, q, u, v, u2; + double F, f, g, q, u, v, u2, one = 1.0; volatile double u1; struct Double r; @@ -460,8 +462,10 @@ __log__D(double x) q = u*v*(A1 + v*(A2 + v*(A3 + v*A4))); if (m | j) u1 = u + 513, u1 -= 513; - else - u1 = u, TRUNC(u1); + else { + u1 = u; + TRUNC(u1); + } u2 = (2.0*(f - F*u1) - u1*f) * g; u1 += m*logF_head[N] + logF_head[j]; diff --git a/lib/libm/noieee_src/n_support.c b/lib/libm/noieee_src/n_support.c index 4b8549e18ea..6093b0080b1 100644 --- a/lib/libm/noieee_src/n_support.c +++ b/lib/libm/noieee_src/n_support.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_support.c,v 1.8 2008/06/12 22:43:36 martynas Exp $ */ +/* $OpenBSD: n_support.c,v 1.9 2008/06/16 21:10:30 martynas Exp $ */ /* $NetBSD: n_support.c,v 1.1 1995/10/10 23:37:06 ragge Exp $ */ /* * Copyright (c) 1985, 1993 @@ -78,13 +78,15 @@ static char sccsid[] = "@(#)support.c 8.1 (Berkeley) 6/4/93"; #include <errno.h> static const unsigned short msign=0x7fff, mexp =0x7f80 ; static const short prep1=57, gap=7, bias=129 ; - static const double novf=1.7E38, nunf=3.0E-39, zero=0.0 ; + static const double novf=1.7E38, nunf=3.0E-39; #else /* defined(__vax__)||defined(tahoe) */ static const unsigned short msign=0x7fff, mexp =0x7ff0 ; static const short prep1=54, gap=4, bias=1023 ; - static const double novf=1.7E308, nunf=3.0E-308,zero=0.0; + static const double novf=1.7E308, nunf=3.0E-308; #endif /* defined(__vax__)||defined(tahoe) */ +static const double zero = 0.0; + double scalbn(double x, int N) { @@ -303,7 +305,6 @@ sqrt(double x) { double q, s, b, r; double t; - double const zero=0.0; int m, n, i; #if defined(__vax__)||defined(tahoe) int k=54; @@ -389,7 +390,6 @@ remainder(double x, double y) #endif static const unsigned short mexp =0x7ff0, m25 =0x0190, m57 =0x0390; - static const double zero=0.0; double hy, y1, t, t1; short k; long n; diff --git a/lib/libm/noieee_src/n_tgamma.c b/lib/libm/noieee_src/n_tgamma.c index de9ff444733..096eb715241 100644 --- a/lib/libm/noieee_src/n_tgamma.c +++ b/lib/libm/noieee_src/n_tgamma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: n_tgamma.c,v 1.1 2008/06/11 20:53:27 martynas Exp $ */ +/* $OpenBSD: n_tgamma.c,v 1.2 2008/06/16 21:10:30 martynas Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -262,22 +262,26 @@ smaller_gam(double x) double t, d; struct Double r, xx; if (x < x0 + LEFT) { - t = x, TRUNC(t); + t = x; + TRUNC(t); d = (t+x)*(x-t); t *= t; - xx.a = (t + x), TRUNC(xx.a); + xx.a = (t + x); + TRUNC(xx.a); xx.b = x - xx.a; xx.b += t; xx.b += d; t = (one-x0); t += x; d = (one-x0); d -= t; d += x; x = xx.a + xx.b; } else { - xx.a = x, TRUNC(xx.a); + xx.a = x; + TRUNC(xx.a); xx.b = x - xx.a; t = x - x0; d = (-x0 -t); d += x; } r = ratfun_gam(t, d); - d = r.a/x, TRUNC(d); + d = r.a/x; + TRUNC(d); r.a -= d*xx.a; r.a -= d*xx.b; r.a += r.b; return (d + r.a/x); } @@ -297,17 +301,20 @@ ratfun_gam(double z, double c) /* return r.a + r.b = a0 + (z+c)^2*p/q, with r.a truncated to 26 bits. */ p = p/q; - t.a = z, TRUNC(t.a); /* t ~= z + c */ + t.a = z; + TRUNC(t.a); /* t ~= z + c */ t.b = (z - t.a) + c; t.b *= (t.a + z); q = (t.a *= t.a); /* t = (z+c)^2 */ TRUNC(t.a); t.b += (q - t.a); - r.a = p, TRUNC(r.a); /* r = P/Q */ + r.a = p; + TRUNC(r.a); /* r = P/Q */ r.b = p - r.a; t.b = t.b*p + t.a*r.b + a0_lo; t.a *= r.a; /* t = (z+c)^2*(P/Q) */ - r.a = t.a + a0_hi, TRUNC(r.a); + r.a = t.a + a0_hi; + TRUNC(r.a); r.b = ((a0_hi-r.a) + t.a) + t.b; return (r); /* r = a0 + t */ } |