The R Project SVN R

Rev

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

Rev 80841 Rev 87946
Line 57... Line 57...
57
    }
57
    }
58
    // R <= 4.0.x  had   return(R_D_fexp( M_2PI*x, -stirlerr(x)-bd0(x,lambda) ));
58
    // R <= 4.0.x  had   return(R_D_fexp( M_2PI*x, -stirlerr(x)-bd0(x,lambda) ));
59
    double yh, yl;
59
    double yh, yl;
60
    ebd0 (x, lambda, &yh, &yl);
60
    ebd0 (x, lambda, &yh, &yl);
61
    yl += stirlerr(x);
61
    yl += stirlerr(x);
62
    Rboolean Lrg_x = (x >= x_LRG); //really large x  <==>  2*pi*x  overflows
62
    bool Lrg_x = (x >= x_LRG); //really large x  <==>  2*pi*x  overflows
63
    double r = Lrg_x
63
    double r = Lrg_x
64
	? M_SQRT_2PI * sqrt(x) // sqrt(.): avoid overflow for very large x
64
	? M_SQRT_2PI * sqrt(x) // sqrt(.): avoid overflow for very large x
65
	: M_2PI * x;
65
	: M_2PI * x;
66
    return give_log
66
    return give_log
67
	? -yl - yh - (Lrg_x ? log(r) : 0.5 * log(r))
67
	? -yl - yh - (Lrg_x ? log(r) : 0.5 * log(r))