The R Project SVN R

Rev

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

Rev 12976 Rev 15252
Line 69... Line 69...
69
# ifdef HAVE_IEEEFP_H
69
# ifdef HAVE_IEEEFP_H
70
#  include <ieeefp.h>		/* others [Solaris 2.5.x], .. */
70
#  include <ieeefp.h>		/* others [Solaris 2.5.x], .. */
71
# endif
71
# endif
72
#endif
72
#endif
73
#if defined(Win32) && defined(_MSC_VER)
73
#if defined(Win32) && defined(_MSC_VER)
74
#include <float.h>
74
# include <float.h>
75
#endif
75
#endif
76
 
76
 
77
int R_finite(double x)
77
int R_finite(double x)
78
{
78
{
79
#ifdef Macintosh
79
#ifdef Macintosh
80
    return isfinite(x);
80
    return isfinite(x);
81
#endif
81
#endif
82
#ifndef FINITE_BROKEN
82
#ifdef HAVE_WORKING_FINITE
83
    return finite(x);
83
    return finite(x);
84
# else
84
#else
85
#  ifdef _AIX
85
# ifdef _AIX
86
#   include <fp.h>
86
#  include <fp.h>
87
     return FINITE(x);
87
     return FINITE(x);
88
#  else
88
# else
89
    return (!isnan(x) & (x != ML_POSINF) & (x != ML_NEGINF));
89
    return (!isnan(x) & (x != ML_POSINF) & (x != ML_NEGINF));
90
#  endif
90
# endif
91
#endif
91
#endif
92
}
92
}
93
 
93
 
94
#else /* not IEEE_754 */
94
#else /* not IEEE_754 */
95
 
95
 
Line 117... Line 117...
117
{
117
{
118
    double q = x1 / x2;
118
    double q = x1 / x2;
119
    return x1 - floor(q) * x2;
119
    return x1 - floor(q) * x2;
120
}
120
}
121
 
121
 
122
#ifdef LOG_BROKEN
122
#ifdef HAVE_WORKING_LOG
123
double R_log(double x) { return(x > 0 ? log(x) : x < 0 ? ML_NAN : ML_NEGINF); }
-
 
124
#else
-
 
125
# define R_log	log
123
# define R_log	log
-
 
124
#else
-
 
125
double R_log(double x) { return(x > 0 ? log(x) : x < 0 ? ML_NAN : ML_NEGINF); }
126
#endif
126
#endif
127
 
127
 
128
double R_pow(double x, double y) /* = x ^ y */
128
double R_pow(double x, double y) /* = x ^ y */
129
{
129
{
130
    if(x == 1. || y == 0.)
130
    if(x == 1. || y == 0.)