changeset 10902:9a64e02e2aad

Validate input arguments for gamma, lgamma.
author Tatsuro MATSUOKA <tmacchant@yahoo.co.jp>
date Mon, 02 Aug 2010 14:25:49 +0900
parents 860427ac9b77
children 9f0f1a89c704
files liboctave/lo-specfun.cc
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/lo-specfun.cc	Fri Aug 20 14:55:53 2010 -0700
+++ b/liboctave/lo-specfun.cc	Mon Aug 02 14:25:49 2010 +0900
@@ -308,7 +308,7 @@
 
   if (xisnan (x))
     result = x;
-  else if (xisinf (x))
+  else if ((x <= 0 && D_NINT (x) == x) || xisinf (x))
     result = octave_Inf;
   else
     F77_XFCN (dlgams, DLGAMS, (x, result, sgngam));
@@ -330,7 +330,7 @@
 
   if (xisnan (x))
     result = x;
-  else if (xisinf (x))
+  else if ((x <= 0 && D_NINT (x) == x) || xisinf (x))
     result = octave_Inf;
   else
     F77_XFCN (dlgams, DLGAMS, (x, result, sgngam));
@@ -373,7 +373,7 @@
 
   if (xisnan (x))
     result = x;
-  else if (xisinf (x))
+  else if ((x <= 0 && D_NINT (x) == x) || xisinf (x))
     result = octave_Float_Inf;
   else
     F77_XFCN (algams, ALGAMS, (x, result, sgngam));
@@ -395,7 +395,7 @@
 
   if (xisnan (x))
     result = x;
-  else if (xisinf (x))
+  else if ((x <= 0 && D_NINT (x) == x) || xisinf (x))
     result = octave_Float_Inf;
   else
     F77_XFCN (algams, ALGAMS, (x, result, sgngam));