try to catch isinf over ieeefp.h

This commit is contained in:
dwarning 2009-01-04 13:23:58 +00:00
parent 994b00783d
commit abc18c40f0
4 changed files with 41 additions and 23 deletions

View File

@ -1,6 +1,7 @@
2009-01-04 Dietmar Warning 2009-01-04 Dietmar Warning
* src/math/misc/isinf.c, Makefile.am: a simple (but ugly) workaround for isinf * src/math/misc/isinf.c, Makefile.am: a simple (but ugly) workaround for isinf
needed by some adms generated models needed by some adms generated models
* src/iclude/ngspice.h, missing_math.h: try to catch isinf by ieeefp.h
* adms/ekv/amsva/ekv.va: compatibility regarding S/D diode behaviour * adms/ekv/amsva/ekv.va: compatibility regarding S/D diode behaviour
2009-01-02 Dietmar Warning 2009-01-02 Dietmar Warning

View File

@ -33,13 +33,17 @@ extern int isnan(double);
#endif #endif
#ifndef HAVE_DECL_ISINF #ifndef HAVE_DECL_ISINF
# ifndef HAVE_ISINF #ifndef HAVE_ISINF
# if defined(HAVE_FINITE) && (defined (HAVE_DECL_ISNAN) || defined (HAVE_ISNAN)) #if defined(HAVE_FINITE) && (defined (HAVE_DECL_ISNAN) || defined (HAVE_ISNAN))
# define isinf(x) (!finite(x) && !isnan(x)) #define isinf(x) (!finite(x) && !isnan(x))
# endif #else
# else #ifdef HAVE_IEEEFP_H
extern int isinf(double); extern int isinf(double);
# endif
#endif #endif
#endif
#else /* HAVE_ISINF */
extern int isinf(double);
#endif /* HAVE_ISINF */
#endif /* HAVE_DECL_ISINF */
#endif /* MISSING_MATH_H_INCLUDED */ #endif /* MISSING_MATH_H_INCLUDED */

View File

@ -31,6 +31,10 @@
#include <math.h> #include <math.h>
#include <stdio.h> #include <stdio.h>
#ifdef HAVE_IEEEFP_H
#include <ieeefp.h>
#endif
#include "missing_math.h" #include "missing_math.h"
#ifdef STDC_HEADERS #ifdef STDC_HEADERS

View File

@ -1,26 +1,35 @@
#include "ngspice.h" #include "ngspice.h"
/* this is really ugly - but it is a emergency case */
#ifndef HAVE_DECL_ISINF #ifndef HAVE_DECL_ISINF
#ifndef HAVE_ISINF #ifndef HAVE_ISINF
static int #ifdef HAVE_IEEEFP_H
isinf(double x)
{
volatile double a = x;
if (a > DBL_MAX) int isinf(double x) { return !finite(x) && x==x; }
return 1;
if (a < -DBL_MAX) #else /* HAVE_IEEEFP_H */
return -1;
return 0; /* this is really ugly - but it is a emergency case */
}
static int
isinf(double x)
{
volatile double a = x;
if (a > DBL_MAX)
return 1;
if (a < -DBL_MAX)
return -1;
return 0;
}
#endif /* HAVE_IEEEFP_H */
/*
* end isinf.c
*/
#else /* HAVE_ISINF */ #else /* HAVE_ISINF */
int Dummy_Symbol_5;
int Dummy_Symbol_5;
#endif /* HAVE_ISINF */ #endif /* HAVE_ISINF */
#endif /* HAVE_DECL_ISINF */ #endif /* HAVE_DECL_ISINF */