erf function (patch from Bernd Gutmann).

This commit is contained in:
Vitor Santos Costa 2010-03-05 00:01:04 +00:00
parent 75d1b897e0
commit 43a1a754dd
6 changed files with 38 additions and 5 deletions

View File

@ -418,6 +418,26 @@ eval1(Int fi, Term t) {
RERROR();
#endif
}
case op_erf:
{
Float dbl = get_float(t), out;
#if HAVE_ERF
out = erf(dbl);
RFLOAT(out);
#else
RERROR();
#endif
}
case op_erfc:
{
Float dbl = get_float(t), out;
#if HAVE_ERF
out = erfc(dbl);
RFLOAT(out);
#else
RERROR();
#endif
}
/*
floor(x) maximum integer greatest or equal to X
@ -814,6 +834,8 @@ static InitUnEntry InitUnTab[] = {
{"float_integer_part", op_fintp},
{"sign", op_sign},
{"lgamma", op_lgamma},
{"erf",op_erf},
{"erfc",op_erfc},
{"random", op_random1}
};

View File

@ -93,6 +93,8 @@ typedef enum {
op_fintp,
op_sign,
op_lgamma,
op_erf,
op_erfc,
op_random1
} arith1_op;

View File

@ -160,6 +160,7 @@
#undef HAVE_CTIME
#undef HAVE_DLOPEN
#undef HAVE_DUP2
#undef HAVE_ERF
#undef HAVE_FECLEAREXCEPT
#undef HAVE_FESETTRAPENABLE
#undef HAVE_FETESTEXCEPT

10
configure vendored
View File

@ -8499,12 +8499,14 @@ _ACEOF
fi
done
for ac_func in feclearexcept
for ac_func in erf feclearexcept
do :
ac_fn_c_check_func "$LINENO" "feclearexcept" "ac_cv_func_feclearexcept"
if test "x$ac_cv_func_feclearexcept" = x""yes; then :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
eval as_val=\$$as_ac_var
if test "x$as_val" = x""yes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_FECLEAREXCEPT 1
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi

View File

@ -1501,7 +1501,7 @@ dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(access)
AC_CHECK_FUNCS(acosh asinh atanh chdir ctime dlopen dup2)
AC_CHECK_FUNCS(feclearexcept)
AC_CHECK_FUNCS(erf feclearexcept)
AC_CHECK_FUNCS(fesettrapenable fgetpos finite fpclass ftime getcwd getenv)
AC_CHECK_FUNCS(gethostbyname gethostid gethostname)
AC_CHECK_FUNCS(gethrtime getpagesize)

View File

@ -3849,6 +3849,12 @@ Hyperbolic arc tangent.
@item lgamma(@var{X})
gamma function.
@item erf(@var{X})
gaussian error function.
@item erfc(@var{X})
complementary gaussian error function.
@item random(@var{X}) [ISO]
An integer random number between 0 and @var{X}.