The R Project SVN R

Rev

Rev 42422 | Rev 58977 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 42422 Rev 42424
Line 27... Line 27...
27
/*
27
/*
28
 *  based on code in ../main/arithmetic.c
28
 *  based on code in ../main/arithmetic.c
29
 *  used only in standalone Rmath lib.
29
 *  used only in standalone Rmath lib.
30
 */
30
 */
31
 
31
 
32
/* Include the header file defining finite() */
-
 
33
#ifdef HAVE_IEEE754_H
-
 
34
# include <ieee754.h>		/* newer Linuxen */
-
 
35
#else
-
 
36
# ifdef HAVE_IEEEFP_H
-
 
37
#  include <ieeefp.h>		/* others [Solaris], .. */
-
 
38
# endif
-
 
39
#endif
-
 
40
 
-
 
41
int R_finite(double x)
32
int R_finite(double x)
42
{
33
{
43
#ifdef HAVE_WORKING_ISFINITE
34
#ifdef HAVE_WORKING_ISFINITE
44
    return isfinite(x);
35
    return isfinite(x);
45
#elif HAVE_WORKING_FINITE
-
 
46
    return finite(x);
-
 
47
# else
-
 
48
/* neither finite nor isfinite work */
-
 
49
# ifdef _AIX
-
 
50
#  include <fp.h>
-
 
51
     return FINITE(x);
-
 
52
# else
36
# else
53
    return (!isnan(x) & (x != ML_POSINF) & (x != ML_NEGINF));
37
    return (!isnan(x) & (x != ML_POSINF) & (x != ML_NEGINF));
54
# endif
-
 
55
#endif
38
#endif
56
}
39
}
57
 
40
 
58
/* C++ math header undefines any isnan macro. This file
41
/* C++ math header undefines any isnan macro. This file
59
   doesn't get C++ headers and so is safe. */
42
   doesn't get C++ headers and so is safe. */