/*************************************************************************\ * Copyright (c) 2002 The University of Chicago, as Operator of Argonne * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * This file is distributed subject to a Software License Agreement found * in the file LICENSE that is included with this distribution. \*************************************************************************/ /* $Log: gammai.c,v $ Revision 1.7 2003/08/28 19:56:26 soliday Cleaned up some of the code. Revision 1.6 2002/08/14 16:18:55 soliday Added Open License Revision 1.5 1999/12/15 16:29:24 soliday Added support for vxWorks. Revision 1.4 1999/07/12 20:37:53 soliday Added call to fdlibm library for lgamma function on WIN32 Revision 1.3 1999/07/08 22:13:16 soliday Added "lgamma function not implemented in WIN32" error message Revision 1.2 1995/09/05 21:19:58 saunders First test release of the SDDS1.5 package. */ /* file: gammai.c * purpose: routines for incomplete gamma function * M. Borland, 1995. * Based on Abramowitz and Stegun and Numerical Recipes */ #include "mdb.h" #if defined(_WIN32) #include "fdlibm.h" #endif double gammaIncSeries(double a, double x); double gammaIncCFrac(double a, double x); #define GAMMAI_ACCURACY 1e-12 double gammaP(double a, double x) { if (a<=0 || x<0) return -1; if (x==0) return 0; if (xGAMMAI_ACCURACY && naccuracy); return factor*f2; }