The R Project SVN R

Rev

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

Rev 8431 Rev 10467
Line 32... Line 32...
32
    if (ISNAN(x) || ISNAN(shape) || ISNAN(scale))
32
    if (ISNAN(x) || ISNAN(shape) || ISNAN(scale))
33
	return x + shape + scale;
33
	return x + shape + scale;
34
#endif
34
#endif
35
    if (shape <= 0 || scale <= 0) ML_ERR_return_NAN;
35
    if (shape <= 0 || scale <= 0) ML_ERR_return_NAN;
36
 
36
 
37
    if (x <= 0) return R_D__0;
37
    if (x < 0) return R_D__0;
38
    if (!R_FINITE(x)) return R_D__0;
38
    if (!R_FINITE(x)) return R_D__0;
39
    tmp1 = pow(x / scale, shape - 1);
39
    tmp1 = pow(x / scale, shape - 1);
40
    tmp2 = tmp1 * (x / scale);
40
    tmp2 = tmp1 * (x / scale);
41
    return  give_log ?
41
    return  give_log ?
42
	-tmp2 + log(shape * tmp1 / scale) :
42
	-tmp2 + log(shape * tmp1 / scale) :