Mercurial > hg > octave-jordi
changeset 11327:ef0e995f8c0f
correctly compute gamma for negative integer values when tgamma is available
author | Marco Atzeri <marco_atzeri@yahoo.it> |
---|---|
date | Thu, 09 Dec 2010 01:15:30 -0500 |
parents | f46aeb3ea6b7 |
children | f286a874617c |
files | liboctave/ChangeLog liboctave/lo-specfun.cc src/ChangeLog src/mappers.cc |
diffstat | 4 files changed, 18 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2010-12-09 Marco Atzeri <marco_atzeri@yahoo.it> + + * lo-specfun.cc (xgamma): Also handle negative integer values as + special cases when using tgamma. + 2010-11-25 John W. Eaton <jwe@octave.org> * Sparse.cc (Sparse<T>::assign): Use correct endpoint for
--- a/liboctave/lo-specfun.cc +++ b/liboctave/lo-specfun.cc @@ -281,9 +281,6 @@ double xgamma (double x) { -#if defined (HAVE_TGAMMA) - return tgamma (x); -#else double result; if (xisnan (x)) @@ -291,10 +288,13 @@ else if ((x <= 0 && D_NINT (x) == x) || xisinf (x)) result = octave_Inf; else +#if defined (HAVE_TGAMMA) + result = tgamma (x); +#else F77_XFCN (xdgamma, XDGAMMA, (x, result)); +#endif return result; -#endif } double @@ -346,9 +346,6 @@ float xgamma (float x) { -#if defined (HAVE_TGAMMAF) - return tgammaf (x); -#else float result; if (xisnan (x)) @@ -356,10 +353,13 @@ else if ((x <= 0 && D_NINT (x) == x) || xisinf (x)) result = octave_Float_Inf; else +#if defined (HAVE_TGAMMAF) + result = tgammaf (x); +#else F77_XFCN (xgamma, XGAMMA, (x, result)); +#endif return result; -#endif } float