The R Project SVN R

Rev

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

Rev 11723 Rev 25818
Line 25... Line 25...
25
 *
25
 *
26
 *    The t density is evaluated as
26
 *    The t density is evaluated as
27
 *         sqrt(n/2) / ((n+1)/2) * Gamma((n+3)/2) / Gamma((n+2)/2).
27
 *         sqrt(n/2) / ((n+1)/2) * Gamma((n+3)/2) / Gamma((n+2)/2).
28
 *             * (1+x^2/n)^(-n/2)
28
 *             * (1+x^2/n)^(-n/2)
29
 *             / sqrt( 2 pi (1+x^2/n) )
29
 *             / sqrt( 2 pi (1+x^2/n) )
-
 
30
 *
30
 *    This form leads to a stable computation for all
31
 *    This form leads to a stable computation for all
31
 *    values of n, including n -> 0 and n -> infinity.
32
 *    values of n, including n -> 0 and n -> infinity.
32
 *
-
 
33
 */
33
 */
34
 
34
 
35
#include "nmath.h"
35
#include "nmath.h"
36
#include "dpq.h"
36
#include "dpq.h"
37
 
37
 
38
double dt(double x, double n, int give_log)
38
double dt(double x, double n, int give_log)
39
{ 
39
{
40
    double t, u;
40
    double t, u;
41
#ifdef IEEE_754
41
#ifdef IEEE_754
42
    if (ISNAN(x) || ISNAN(n))
42
    if (ISNAN(x) || ISNAN(n))
43
	return x + n;
43
	return x + n;
44
#endif
44
#endif