diff liboctave/lo-specfun.cc @ 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 9a64e02e2aad
children 141b3fb5cef7
line wrap: on
line diff
--- a/liboctave/lo-specfun.cc	Thu Dec 09 01:01:58 2010 -0500
+++ b/liboctave/lo-specfun.cc	Thu Dec 09 01:15:30 2010 -0500
@@ -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