3 changed files with 37 additions and 42 deletions
@ -1,35 +1,31 @@ |
|||||
#include "ngspice.h" |
#include "ngspice.h" |
||||
|
|
||||
#if (HAVE_DECL_ISINF < 1) |
|
||||
|
|
||||
|
#if !HAVE_DECL_ISINF |
||||
#ifndef HAVE_ISINF |
#ifndef HAVE_ISINF |
||||
|
|
||||
#ifdef HAVE_IEEEFP_H |
#ifdef HAVE_IEEEFP_H |
||||
|
|
||||
int isinf(double x) { return !finite(x) && x==x; } |
|
||||
|
int isinf(double x) { return !finite(x) && x==x; } |
||||
|
|
||||
#else /* HAVE_IEEEFP_H */ |
#else /* HAVE_IEEEFP_H */ |
||||
|
|
||||
/* 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 */ |
|
||||
|
/* this is really ugly - but it is a emergency case */ |
||||
|
|
||||
#else /* HAVE_ISINF */ |
|
||||
|
static int |
||||
|
isinf (const double x) |
||||
|
{ |
||||
|
double y = x - x; |
||||
|
int s = (y != y); |
||||
|
|
||||
int Dummy_Symbol_5; |
|
||||
|
if (s && x > 0) |
||||
|
return +1; |
||||
|
else if (s && x < 0) |
||||
|
return -1; |
||||
|
else |
||||
|
return 0; |
||||
|
} |
||||
|
|
||||
|
#endif /* HAVE_IEEEFP_H */ |
||||
|
#else /* HAVE_ISINF */ |
||||
|
int Dummy_Symbol_5; |
||||
#endif /* HAVE_ISINF */ |
#endif /* HAVE_ISINF */ |
||||
|
|
||||
#endif /* HAVE_DECL_ISINF */ |
#endif /* HAVE_DECL_ISINF */ |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue