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(); RERROR();
#endif #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 floor(x) maximum integer greatest or equal to X
@ -814,6 +834,8 @@ static InitUnEntry InitUnTab[] = {
{"float_integer_part", op_fintp}, {"float_integer_part", op_fintp},
{"sign", op_sign}, {"sign", op_sign},
{"lgamma", op_lgamma}, {"lgamma", op_lgamma},
{"erf",op_erf},
{"erfc",op_erfc},
{"random", op_random1} {"random", op_random1}
}; };

View File

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

View File

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

10
configure vendored
View File

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

View File

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

View File

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