summaryrefslogtreecommitdiff
path: root/missing/erf.c
diff options
context:
space:
mode:
Diffstat (limited to 'missing/erf.c')
-rw-r--r--missing/erf.c29
1 files changed, 5 insertions, 24 deletions
diff --git a/missing/erf.c b/missing/erf.c
index dad2644a7e..c2c9d5f7e9 100644
--- a/missing/erf.c
+++ b/missing/erf.c
@@ -3,31 +3,15 @@
reference - Haruhiko Okumura: C-gengo niyoru saishin algorithm jiten
(New Algorithm handbook in C language) (Gijyutsu hyouron
sha, Tokyo, 1991) p.227 [in Japanese] */
-#include "missing.h"
+#include "ruby/missing.h"
#include <stdio.h>
#include <math.h>
-#ifdef _WIN32
-# include <float.h>
-# if !defined __MINGW32__ || defined __NO_ISOCEXT
-# ifndef isnan
-# define isnan(x) _isnan(x)
-# endif
-# ifndef isinf
-# define isinf(x) (!_finite(x) && !_isnan(x))
-# endif
-# ifndef finite
-# define finite(x) _finite(x)
-# endif
-# endif
-#endif
-
static double q_gamma(double, double, double);
/* Incomplete gamma function
1 / Gamma(a) * Int_0^x exp(-t) t^(a-1) dt */
-static double p_gamma(a, x, loggamma_a)
- double a, x, loggamma_a;
+static double p_gamma(double a, double x, double loggamma_a)
{
int k;
double result, term, previous;
@@ -46,8 +30,7 @@ static double p_gamma(a, x, loggamma_a)
/* Incomplete gamma function
1 / Gamma(a) * Int_x^inf exp(-t) t^(a-1) dt */
-static double q_gamma(a, x, loggamma_a)
- double a, x, loggamma_a;
+static double q_gamma(double a, double x, double loggamma_a)
{
int k;
double result, w, temp, previous;
@@ -70,8 +53,7 @@ static double q_gamma(a, x, loggamma_a)
#define LOG_PI_OVER_2 0.572364942924700087071713675675 /* log_e(PI)/2 */
-double erf(x)
- double x;
+double erf(double x)
{
if (!finite(x)) {
if (isnan(x)) return x; /* erf(NaN) = NaN */
@@ -81,8 +63,7 @@ double erf(x)
else return - p_gamma(0.5, x * x, LOG_PI_OVER_2);
}
-double erfc(x)
- double x;
+double erfc(double x)
{
if (!finite(x)) {
if (isnan(x)) return x; /* erfc(NaN) = NaN */