File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -218,6 +218,11 @@ DEVICE double GammaP (double n, double x)
218
218
{ /* --- regularized Gamma function P */
219
219
if ((n <= 0 ) || (x < 0 )) return NPY_NAN ; /* check the function arguments */
220
220
if (x <= 0 ) return 0 ; /* treat x = 0 as a special case */
221
+ if (isinf (n )) {
222
+ if (isinf (x )) return NPY_NAN ;
223
+ return 0 ;
224
+ }
225
+ if (isinf (x )) return 1 ;
221
226
if (x < n + 1 ) return _series (n , x ) * exp (n * log (x ) - x - logGamma (n ));
222
227
return 1 - _cfrac (n , x ) * exp (n * log (x ) - x - logGamma (n ));
223
228
} /* GammaP() */
@@ -228,6 +233,11 @@ DEVICE double GammaQ (double n, double x)
228
233
{ /* --- regularized Gamma function Q */
229
234
if ((n <= 0 ) || (x < 0 )) return NPY_NAN ; /* check the function arguments */
230
235
if (x <= 0 ) return 1 ; /* treat x = 0 as a special case */
236
+ if (isinf (n )) {
237
+ if (isinf (x )) return NPY_NAN ;
238
+ return 1 ;
239
+ }
240
+ if (isinf (x )) return 0 ;
231
241
if (x < n + 1 ) return 1 - _series (n , x ) * exp (n * log (x ) - x - logGamma (n ));
232
242
return _cfrac (n , x ) * exp (n * log (x ) - x - logGamma (n ));
233
243
} /* GammaQ() */
You can’t perform that action at this time.
0 commit comments