Mercurial > octave
changeset 23634:ff68c9d024b8
Use erf, erff, erfc, erfcf from C++ std library.
These functions are guaranteed to be part of C++11 standard library.
* configure.ac: Remove AC_CHECK_FUNCS for erf, erff, erfc, erfcf.
* lo-specfun.cc (erf, erff, erfc, erfcf): Delegate to std::XXX for erf, erff,
erfc, erfcf.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 17 Jun 2017 10:26:38 -0700 |
parents | 271d34c20678 |
children | b5a9cd6de1b8 |
files | configure.ac liboctave/numeric/lo-specfun.cc |
diffstat | 2 files changed, 12 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.ac Fri Jun 16 22:30:00 2017 -0700 +++ b/configure.ac Sat Jun 17 10:26:38 2017 -0700 @@ -2455,7 +2455,7 @@ ## Check for nonstandard, but common math functions, that we need. dnl Use multiple AC_CHECKs to avoid line continuations '\' in list -AC_CHECK_FUNCS([erf erff erfc erfcf exp2f]) +AC_CHECK_FUNCS([exp2f]) ## Check for math defines such as M_LN2 in math.h AC_CACHE_CHECK([for MATH DEFINES in math.h],
--- a/liboctave/numeric/lo-specfun.cc Fri Jun 16 22:30:00 2017 -0700 +++ b/liboctave/numeric/lo-specfun.cc Sat Jun 17 10:26:38 2017 -0700 @@ -133,29 +133,9 @@ #endif } - double - erf (double x) - { -#if defined (HAVE_ERF) - return ::erf (x); -#else - double retval; - F77_XFCN (xderf, XDERF, (x, retval)); - return retval; -#endif - } - - float - erf (float x) - { -#if defined (HAVE_ERFF) - return erff (x); -#else - float retval; - F77_XFCN (xerf, XERF, (x, retval)); - return retval; -#endif - } + double erf (double x) { return std::erf (x); } + + float erf (float x) { return std::erff (x); } // Complex error function from the Faddeeva package Complex @@ -172,29 +152,9 @@ return FloatComplex (ret.real (), ret.imag ()); } - double - erfc (double x) - { -#if defined (HAVE_ERFC) - return ::erfc (x); -#else - double retval; - F77_XFCN (xderfc, XDERFC, (x, retval)); - return retval; -#endif - } - - float - erfc (float x) - { -#if defined (HAVE_ERFCF) - return erfcf (x); -#else - float retval; - F77_XFCN (xerfc, XERFC, (x, retval)); - return retval; -#endif - } + double erfc (double x) { return std::erfc (x); } + + float erfc (float x) { return std::erfcf (x); } // Complex complementary error function from the Faddeeva package Complex @@ -211,7 +171,7 @@ return FloatComplex (ret.real (), ret.imag ()); } - // Real and complex scaled complementary error function from Faddeeva package + // Real and complex scaled complementary error function from Faddeeva pkg. float erfcx (float x) { return Faddeeva::erfcx(x); } double erfcx (double x) { return Faddeeva::erfcx(x); } @@ -225,7 +185,8 @@ erfcx (const FloatComplex& x) { Complex xd (x.real (), x.imag ()); - Complex ret = Faddeeva::erfcx (xd, std::numeric_limits<float>::epsilon ()); + Complex ret; + ret = Faddeeva::erfcx (xd, std::numeric_limits<float>::epsilon ()); return FloatComplex (ret.real (), ret.imag ()); } @@ -261,7 +222,8 @@ dawson (const FloatComplex& x) { Complex xd (x.real (), x.imag ()); - Complex ret = Faddeeva::Dawson (xd, std::numeric_limits<float>::epsilon ()); + Complex ret; + ret = Faddeeva::Dawson (xd, std::numeric_limits<float>::epsilon ()); return FloatComplex (ret.real (), ret.imag ()); }