The R Project SVN R

Rev

Rev 2629 | Rev 4562 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2629 Rev 3076
Line 33... Line 33...
33
 *    V. Kachitvichyanukul and B. Schmeiser (1985).
33
 *    V. Kachitvichyanukul and B. Schmeiser (1985).
34
 *    ``Computer generation of hypergeometric random variates,''
34
 *    ``Computer generation of hypergeometric random variates,''
35
 *    Journal of Statistical Computation and Simulation 22, 127-145.
35
 *    Journal of Statistical Computation and Simulation 22, 127-145.
36
 */
36
 */
37
 
37
 
38
#include "PrtUtil.h"
-
 
39
#include "Mathlib.h"
38
#include "Mathlib.h"
40
 
39
 
41
/* afc(i) :=  ln( i! )	[logarithm of the factorial i.
40
/* afc(i) :=  ln( i! )	[logarithm of the factorial i.
42
 *	   If (i > 7), use Stirling's approximation, otherwise use table lookup.
41
 *	   If (i > 7), use Stirling's approximation, otherwise use table lookup.
43
*/
42
*/
Line 58... Line 57...
58
 
57
 
59
static double afc(int i)
58
static double afc(int i)
60
{
59
{
61
    double di, value;
60
    double di, value;
62
    if (i < 0) {
61
    if (i < 0) {
63
      REprintf("rhyper.c: afc(i), i=%d < 0 -- SHOULD NOT HAPPEN!\n",i);
62
      MATHLIB_WARNING("rhyper.c: afc(i), i=%d < 0 -- SHOULD NOT HAPPEN!\n",i);
64
      return -1;/* unreached (Wall) */
63
      return -1;/* unreached (Wall) */
65
    } else if (i <= 7) {
64
    } else if (i <= 7) {
66
	value = al[i + 1];
65
	value = al[i + 1];
67
    } else {
66
    } else {
68
	di = i;
67
	di = i;