Fix the vax build under gcc-4.5 which now detects that floating constants

don't fit or are effectively 0.
This commit is contained in:
christos 2011-11-02 02:34:56 +00:00
parent 89986fc527
commit c1d5350b00
10 changed files with 99 additions and 48 deletions

View File

@ -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 @@ cproj(double complex z)
{
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

View File

@ -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 @@ cprojf(float complex z)
{
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

View File

@ -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 @@ cprojl(long double complex z)
{
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

View File

@ -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.

View File

@ -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 @@ static char sccsid[] = "@(#)erf.c 8.1 (Berkeley) 6/4/93";
#endif
static const double
tiny = 1e-300,
tiny = _TINY,
half = 0.5,
one = 1.0,
two = 2.0,
@ -275,7 +275,7 @@ erf(double x)
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;
}

View File

@ -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 @@ static struct Double ratfun_gam (double, double);
#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.

View File

@ -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 char sccsid[] = "@(#)j0.c 8.2 (Berkeley) 11/30/93";
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 @@ j0(double x)
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(double x)
* 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 @@ y0(double x)
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 @@ y0(double x)
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);
}

View File

@ -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 char sccsid[] = "@(#)j1.c 8.2 (Berkeley) 11/30/93";
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 @@ j1(double x)
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 @@ y1(double x)
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);
#else
return (infnan(EDOM));
#endif
}
if (x <= 0) {
if (_IEEE && x == 0) return -one/zero;
else if(x == 0) return(infnan(-ERANGE));
else if(_IEEE) return (zero/zero);
else return(infnan(EDOM));
#if _IEEE
if (x == 0) return -one/zero;
#endif
if(x == 0) return(infnan(-ERANGE));
#if _IEEE
return (zero/zero);
#else
return(infnan(EDOM));
#endif
}
if (x >= 2) { /* |x| >= 2.0 */
s = sin(x);
@ -247,9 +257,12 @@ y1(double x)
* sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
* to compute the worse one.
*/
if (_IEEE && x>two_129) {
#if _IEEE
if (x>two_129) {
z = (invsqrtpi*ss)/sqrt(x);
} else {
} else
#endif
{
u = pone(x); v = qone(x);
z = invsqrtpi*(u*ss+v*cc)/sqrt(x);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: n_jn.c,v 1.6 2003/08/07 16:44:51 agc Exp $ */
/* $NetBSD: n_jn.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.
@ -118,7 +118,9 @@ jn(int n, double x)
* Thus, J(-n,x) = J(n,-x)
*/
/* if J(n,NaN) is NaN */
if (_IEEE && isnan(x)) return x+x;
#if _IEEE
if (snan(x)) return x+x;
#endif
if (n<0){
n = -n;
x = -x;
@ -131,7 +133,8 @@ jn(int n, double x)
b = zero;
else if ((double) n <= x) {
/* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */
if (_IEEE && x >= 8.148143905337944345e+090) {
#if _IEEE
if (x >= 8.148143905337944345e+090) {
/* x >= 2**302 */
/* (x >> n**2)
* Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi)
@ -153,7 +156,9 @@ jn(int n, double x)
case 3: temp = cos(x)-sin(x); break;
}
b = invsqrtpi*temp/sqrt(x);
} else {
} else
#endif
{
a = j0(x);
b = j1(x);
for(i=1;i<n;i++){
@ -274,7 +279,8 @@ yn(int n, double x)
}
if (n == 0) return(y0(x));
if (n == 1) return(sign*y1(x));
if(_IEEE && x >= 8.148143905337944345e+090) { /* x > 2**302 */
#if _IEEE
if(x >= 8.148143905337944345e+090) { /* x > 2**302 */
/* (x >> n**2)
* Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi)
* Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi)
@ -295,7 +301,9 @@ yn(int n, double x)
case 3: temp = sin(x)+cos(x); break;
}
b = invsqrtpi*temp/sqrt(x);
} else {
} else
#endif
{
a = y0(x);
b = y1(x);
/* quit if b is -inf */

View File

@ -1,4 +1,4 @@
/* $NetBSD: n_pow.c,v 1.7 2003/08/07 16:44:52 agc Exp $ */
/* $NetBSD: n_pow.c,v 1.8 2011/11/02 02:34:56 christos Exp $ */
/*
* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
@ -176,7 +176,7 @@ static double
pow_P(double x, double y)
{
struct Double s, t;
double huge = 1e300, tiny = 1e-300;
double huge = _HUGE, tiny = _TINY;
if (x == zero) {
if (y > zero)