Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libm Fix the vax build under gcc-4.5 which now detects t...
details: https://anonhg.NetBSD.org/src/rev/8bb71ca18a59
branches: trunk
changeset: 770787:8bb71ca18a59
user: christos <christos%NetBSD.org@localhost>
date: Wed Nov 02 02:34:56 2011 +0000
description:
Fix the vax build under gcc-4.5 which now detects that floating constants
don't fit or are effectively 0.
diffstat:
lib/libm/complex/cproj.c | 7 +++--
lib/libm/complex/cprojf.c | 7 +++--
lib/libm/complex/cprojl.c | 7 +++--
lib/libm/noieee_src/mathimpl.h | 13 +++++++++++-
lib/libm/noieee_src/n_erf.c | 6 ++--
lib/libm/noieee_src/n_gamma.c | 4 +-
lib/libm/noieee_src/n_j0.c | 44 ++++++++++++++++++++++++++++-------------
lib/libm/noieee_src/n_j1.c | 35 ++++++++++++++++++++++----------
lib/libm/noieee_src/n_jn.c | 20 +++++++++++++-----
lib/libm/noieee_src/n_pow.c | 4 +-
10 files changed, 99 insertions(+), 48 deletions(-)
diffs (truncated from 416 to 300 lines):
diff -r e8dd20ea8676 -r 8bb71ca18a59 lib/libm/complex/cproj.c
--- a/lib/libm/complex/cproj.c Wed Nov 02 01:17:59 2011 +0000
+++ b/lib/libm/complex/cproj.c Wed Nov 02 02:34:56 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cproj.c,v 1.4 2011/03/02 13:24:43 christos Exp $ */
+/* $NetBSD: cproj.c,v 1.5 2011/11/02 02:34:56 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: cproj.c,v 1.4 2011/03/02 13:24:43 christos Exp $");
+__RCSID("$NetBSD: cproj.c,v 1.5 2011/11/02 02:34:56 christos Exp $");
#include <complex.h>
#include <math.h>
@@ -50,9 +50,10 @@
{
double_complex w = { .z = z };
+ /*CONSTCOND*/
if (isinf(creal(z)) || isinf(cimag(z))) {
#ifdef __INFINITY
- REAL_PART(w) = __INFINITY;
+ REAL_PART(w) = HUGE_VAL;
#else
REAL_PART(w) = INFINITY;
#endif
diff -r e8dd20ea8676 -r 8bb71ca18a59 lib/libm/complex/cprojf.c
--- a/lib/libm/complex/cprojf.c Wed Nov 02 01:17:59 2011 +0000
+++ b/lib/libm/complex/cprojf.c Wed Nov 02 02:34:56 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cprojf.c,v 1.4 2011/03/02 13:24:43 christos Exp $ */
+/* $NetBSD: cprojf.c,v 1.5 2011/11/02 02:34:56 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: cprojf.c,v 1.4 2011/03/02 13:24:43 christos Exp $");
+__RCSID("$NetBSD: cprojf.c,v 1.5 2011/11/02 02:34:56 christos Exp $");
#include <complex.h>
#include <math.h>
@@ -51,9 +51,10 @@
{
float_complex w = { .z = z };
+ /*CONSTCOND*/
if (isinf(crealf(z)) || isinf(cimagf(z))) {
#ifdef __INFINITY
- REAL_PART(w) = __INFINITY;
+ REAL_PART(w) = HUGE_VAL;
#else
REAL_PART(w) = INFINITY;
#endif
diff -r e8dd20ea8676 -r 8bb71ca18a59 lib/libm/complex/cprojl.c
--- a/lib/libm/complex/cprojl.c Wed Nov 02 01:17:59 2011 +0000
+++ b/lib/libm/complex/cprojl.c Wed Nov 02 02:34:56 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cprojl.c,v 1.5 2011/03/02 13:24:43 christos Exp $ */
+/* $NetBSD: cprojl.c,v 1.6 2011/11/02 02:34:56 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: cprojl.c,v 1.5 2011/03/02 13:24:43 christos Exp $");
+__RCSID("$NetBSD: cprojl.c,v 1.6 2011/11/02 02:34:56 christos Exp $");
#include <complex.h>
#include <math.h>
@@ -50,9 +50,10 @@
{
long_double_complex w = { .z = z };
+ /*CONSTCOND*/
if (isinf(creall(z)) || isinf(cimagl(z))) {
#ifdef __INFINITY
- REAL_PART(w) = __INFINITY;
+ REAL_PART(w) = HUGE_VAL;
#else
REAL_PART(w) = INFINITY;
#endif
diff -r e8dd20ea8676 -r 8bb71ca18a59 lib/libm/noieee_src/mathimpl.h
--- a/lib/libm/noieee_src/mathimpl.h Wed Nov 02 01:17:59 2011 +0000
+++ b/lib/libm/noieee_src/mathimpl.h Wed Nov 02 02:34:56 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mathimpl.h,v 1.9 2008/05/01 15:33:15 christos Exp $ */
+/* $NetBSD: mathimpl.h,v 1.10 2011/11/02 02:34:56 christos Exp $ */
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -99,6 +99,17 @@
#endif /* defined(__vax__)||defined(tahoe) */
+#ifdef __vax__
+#include <machine/float.h>
+#define _TINY DBL_EPSILON
+#define _TINYER DBL_EPSILON
+#define _HUGE DBL_MAX
+#else
+#define _TINY 1e-300
+#define _TINYER 1e-308
+#define _HUGE 1e+300
+#endif
+
/*
* Functions internal to the math package, yet not static.
diff -r e8dd20ea8676 -r 8bb71ca18a59 lib/libm/noieee_src/n_erf.c
--- a/lib/libm/noieee_src/n_erf.c Wed Nov 02 01:17:59 2011 +0000
+++ b/lib/libm/noieee_src/n_erf.c Wed Nov 02 02:34:56 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: n_erf.c,v 1.7 2005/05/03 04:18:32 matt Exp $ */
+/* $NetBSD: n_erf.c,v 1.8 2011/11/02 02:34:56 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -161,7 +161,7 @@
#endif
static const double
-tiny = 1e-300,
+tiny = _TINY,
half = 0.5,
one = 1.0,
two = 2.0,
@@ -275,7 +275,7 @@
ax = - ax;
if (ax < .84375) {
if (ax < 3.7e-09) {
- if (ax < 1.0e-308)
+ if (ax < _TINYER)
return 0.125*(8.0*x+p0t8*x); /*avoid underflow */
return x + p0*x;
}
diff -r e8dd20ea8676 -r 8bb71ca18a59 lib/libm/noieee_src/n_gamma.c
--- a/lib/libm/noieee_src/n_gamma.c Wed Nov 02 01:17:59 2011 +0000
+++ b/lib/libm/noieee_src/n_gamma.c Wed Nov 02 02:34:56 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: n_gamma.c,v 1.6 2006/11/24 21:15:54 wiz Exp $ */
+/* $NetBSD: n_gamma.c,v 1.7 2011/11/02 02:34:56 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -119,7 +119,7 @@
#define Pa6 5.69394463439411649408050664078e-03
#define Pa7 -1.44705562421428915453880392761e-02
-static const double zero = 0., one = 1.0, tiny = 1e-300;
+static const double zero = 0., one = 1.0, tiny = _TINY;
/*
* TRUNC sets trailing bits in a floating-point number to zero.
* is a temporary variable.
diff -r e8dd20ea8676 -r 8bb71ca18a59 lib/libm/noieee_src/n_j0.c
--- a/lib/libm/noieee_src/n_j0.c Wed Nov 02 01:17:59 2011 +0000
+++ b/lib/libm/noieee_src/n_j0.c Wed Nov 02 02:34:56 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: n_j0.c,v 1.6 2003/08/07 16:44:51 agc Exp $ */
+/* $NetBSD: n_j0.c,v 1.7 2011/11/02 02:34:56 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -123,7 +123,7 @@
static double pzero (double), qzero (double);
static const double
-huge = 1e300,
+huge = _HUGE,
zero = 0.0,
one = 1.0,
invsqrtpi= 5.641895835477562869480794515607725858441e-0001,
@@ -144,8 +144,11 @@
double z, s,c,ss,cc,r,u,v;
if (!finite(x)) {
- if (_IEEE) return one/(x*x);
- else return (0);
+#if _IEEE
+ return one/(x*x);
+#else
+ return (0);
+#endif
}
x = fabs(x);
if (x >= 2.0) { /* |x| >= 2.0 */
@@ -162,9 +165,12 @@
* j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x)
* y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x)
*/
- if (_IEEE && x> 6.80564733841876927e+38) /* 2^129 */
+#if _IEEE
+ if (x > 6.80564733841876927e+38) /* 2^129 */
z = (invsqrtpi*cc)/sqrt(x);
- else {
+ else
+#endif
+ {
u = pzero(x); v = qzero(x);
z = invsqrtpi*(u*cc-v*ss)/sqrt(x);
}
@@ -207,18 +213,25 @@
double z, s, c, ss, cc, u, v;
/* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0 */
if (!finite(x)) {
- if (_IEEE)
+#if _IEEE
return (one/(x+x*x));
- else
+#else
return (0);
+#endif
}
if (x == 0) {
- if (_IEEE) return (-one/zero);
- else return(infnan(-ERANGE));
+#if _IEEE
+ return (-one/zero);
+#else
+ return(infnan(-ERANGE));
+#endif
}
if (x<0) {
- if (_IEEE) return (zero/zero);
- else return (infnan(EDOM));
+#if _IEEE
+ return (zero/zero);
+#else
+ return (infnan(EDOM));
+#endif
}
if (x >= 2.00) { /* |x| >= 2.0 */
/* y0(x) = sqrt(2/(pi*x))*(p0(x)*sin(x0)+q0(x)*cos(x0))
@@ -245,9 +258,12 @@
if ((s*c)<zero) cc = z/ss;
else ss = z/cc;
}
- if (_IEEE && x > 6.80564733841876927e+38) /* > 2^129 */
+#if _IEEE
+ if (x > 6.80564733841876927e+38) /* > 2^129 */
z = (invsqrtpi*ss)/sqrt(x);
- else {
+ else
+#endif
+ {
u = pzero(x); v = qzero(x);
z = invsqrtpi*(u*ss+v*cc)/sqrt(x);
}
diff -r e8dd20ea8676 -r 8bb71ca18a59 lib/libm/noieee_src/n_j1.c
--- a/lib/libm/noieee_src/n_j1.c Wed Nov 02 01:17:59 2011 +0000
+++ b/lib/libm/noieee_src/n_j1.c Wed Nov 02 02:34:56 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: n_j1.c,v 1.6 2003/08/07 16:44:51 agc Exp $ */
+/* $NetBSD: n_j1.c,v 1.7 2011/11/02 02:34:56 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -123,7 +123,7 @@
static double pone (double), qone (double);
static const double
-huge = 1e300,
+huge = _HUGE,
zero = 0.0,
one = 1.0,
invsqrtpi= 5.641895835477562869480794515607725858441e-0001,
@@ -149,9 +149,11 @@
double z, s,c,ss,cc,r,u,v,y;
y = fabs(x);
if (!finite(x)) { /* Inf or NaN */
- if (_IEEE && x != x)
+#if _IEEE
+ if (x != x)
return(x);
else
+#endif
return (copysign(x, zero));
}
y = fabs(x);
@@ -212,19 +214,27 @@
double z, s, c, ss, cc, u, v;
/* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */
if (!finite(x)) {
- if (!_IEEE) return (infnan(EDOM));
- else if (x < 0)
+#if _IEEE
+ if (x < 0)
return(zero/zero);
else if (x > 0)
return (0);
else
return(x);
Home |
Main Index |
Thread Index |
Old Index