The R Project SVN R

Rev

Rev 86200 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 86200 Rev 87903
Line 1... Line 1...
1
/*
1
/*
2
 *  Mathlib : A C Library of Special Functions
2
 *  Mathlib : A C Library of Special Functions
3
 *  Copyright (C) 2004-2024 The R Foundation
3
 *  Copyright (C) 2004-2025 The R Foundation
4
 *  Copyright (C) 1998      Ross Ihaka
4
 *  Copyright (C) 1998      Ross Ihaka
5
 *
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; either version 2 of the License, or
8
 *  the Free Software Foundation; either version 2 of the License, or
Line 44... Line 44...
44
 
44
 
45
#ifndef MATHLIB_STANDALONE
45
#ifndef MATHLIB_STANDALONE
46
void R_CheckStack(void);
46
void R_CheckStack(void);
47
#endif
47
#endif
48
 
48
 
49
double attribute_hidden lfastchoose(double n, double k)
49
attribute_hidden double lfastchoose(double n, double k)
50
{
50
{
51
    return -log(n + 1.) - lbeta(n - k + 1., k + 1.);
51
    return -log(n + 1.) - lbeta(n - k + 1., k + 1.);
52
}
52
}
53
/* mathematically the same:
53
/* mathematically the same:
54
   less stable typically, but useful if n-k+1 < 0 : */
54
   less stable typically, but useful if n-k+1 < 0 : */