In change
a9afcdd22, "Use gsl_isnan instead of isnan, ...," isfinite,
isnan, and isinf were changed to use the GSL substitutes because of
lack of portability of the C99 versions. Now, gnulib has portable
versions of all of these, so change them back.
This commit changes calls to gsl_finite() to call isfinite() instead
of the equivalent finite(). isfinite() is correct here: both gsl_finite()
and finite() return true for NaNs, which is a surprising result given
that a NaN is definitely not finite, but isfinite() returns false and,
more importantly, behaves as actually wanted in each place it is used
in PSPP code.
This commit requires upgrading gnulib to at least change
5183a0e3c,
"Add missing dependencies on new m4/exponent[fdl].m4 files," or later,
and re-running "make -f Smake".
gettext-h \
gettimeofday \
isfinite \
+ isinf \
+ isnan \
intprops \
inttostr \
localcharset \
#include <ctype.h>
#include <float.h>
-#include <gsl/gsl_math.h>
#include <math.h>
#include <stdint.h>
#include <stdlib.h>
{
const char *s;
- if (gsl_isnan (number))
+ if (isnan (number))
s = "NaN";
- else if (gsl_isinf (number))
+ else if (isinf (number))
s = number > 0 ? "+Infinity" : "-Infinity";
else
s = "Unknown";
#include <ctype.h>
#include <errno.h>
#include <float.h>
-#include <gsl/gsl_math.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
0...30**6, an invariant of the loop below. */
errno = 0;
base_2_sig = frexp (value, &base_2_exp);
- if (errno != 0 || !gsl_finite (base_2_sig))
+ if (errno != 0 || !isfinite (base_2_sig))
goto missing_value;
if (base_2_exp == 0 && base_2_sig == 0.)
goto zero;
#include "control-stack.h"
-#include <gsl/gsl_math.h>
-
#include <data/case.h>
#include <data/dictionary.h>
#include <data/procedure.h>
case_data_rw (c, loop->index_var)->f = loop->cur;
/* Throw out pathological cases. */
- if (!gsl_finite (loop->cur) || !gsl_finite (loop->by)
- || !gsl_finite (loop->last)
+ if (!isfinite (loop->cur) || !isfinite (loop->by)
+ || !isfinite (loop->last)
|| loop->by == 0.0
|| (loop->by > 0.0 && loop->cur > loop->last)
|| (loop->by < 0.0 && loop->cur < loop->last))
#include <language/data-io/inpt-pgm.h>
#include <float.h>
-#include <gsl/gsl_math.h>
#include <stdlib.h>
#include <data/case.h>
else
{
double column = expr_evaluate_num (t->column, c, case_num);
- if (!gsl_finite (column) || column < 1)
+ if (!isfinite (column) || column < 1)
{
msg (SE, _("REREAD: Column numbers must be positive finite "
"numbers. Column set to 1."));
#include "private.h"
#include <ctype.h>
-#include <gsl/gsl_math.h>
#include <libpspp/assertion.h>
#include <libpspp/message.h>
#include "helpers.h"
break;
case OP_return_number:
- *(double *) result = gsl_finite (ns[-1]) ? ns[-1] : SYSMIS;
+ *(double *) result = isfinite (ns[-1]) ? ns[-1] : SYSMIS;
return;
case OP_return_string:
#include <ctype.h>
#include <float.h>
#include <gsl/gsl_cdf.h>
-#include <gsl/gsl_math.h>
#include <gsl/gsl_randist.h>
#include <gsl/gsl_sf.h>
#include <limits.h>
static inline bool
is_valid (double d)
{
- return gsl_finite (d) && d != SYSMIS;
+ return isfinite (d) && d != SYSMIS;
}
size_t count_valid (double *, size_t);
#include "message.h"
#include <assert.h>
#include <ctype.h>
-#include <gsl/gsl_math.h>
#include <limits.h>
#include <stdbool.h>
#include <stdlib.h>
unsigned
hsh_hash_double (double d)
{
- if (!gsl_isnan (d))
+ if (!isnan (d))
return hsh_hash_bytes (&d, sizeof d);
else
return 0;
}
pred = pspp_linreg_predict (predictors, vals, c, n_vals);
- result = gsl_isnan (pred) ? GSL_NAN : (obs->f - pred);
+ result = isnan (pred) ? GSL_NAN : (obs->f - pred);
return result;
}
#include <config.h>
#include "moments.h"
#include <assert.h>
-#include <gsl/gsl_math.h>
#include <math.h>
#include <stdlib.h>
#include <libpspp/misc.h>
{
double s3 = s2 * sqrt (s2);
double g1 = (w * d3) / ((w - 1.0) * (w - 2.0) * s3);
- if (gsl_finite (g1))
+ if (isfinite (g1))
*skewness = g1;
}
if (max_moment >= MOMENT_KURTOSIS && kurtosis != NULL && w > 3.)
double den = (w - 2.) * (w - 3.) * pow2 (s2);
double g2 = (w * (w + 1) * d4 / (w - 1.) / den
- 3. * pow2 (d2) / den);
- if (gsl_finite (g2))
+ if (isfinite (g2))
*kurtosis = g2;
}
}
#include <config.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_vector.h>
-#include <gsl/gsl_math.h>
#include <stdlib.h>
#include <libpspp/compiler.h>
#include <math/coefficient.h>
for (n = 0; n < data->size2; n++)
{
tmp = gsl_matrix_get (data, i, n);
- if (!gsl_isnan (tmp))
+ if (!isnan (tmp))
{
est[n]->n_obs += 1.0;
d = (tmp - est[n]->mean) / est[n]->n_obs;
{
xj = gsl_vector_get (&x.vector, j);
yj = gsl_vector_get (&y.vector, j);
- if (!gsl_isnan (xj))
+ if (!isnan (xj))
{
- if (!gsl_isnan (yj))
+ if (!isnan (yj))
{
xj -= est[j]->mean;
yj -= est[j]->mean;