| 47 | shape * tmp1 * ::exp(-tmp2); |
| 48 | } |
| 49 | inline double pweibull_1(double x, double shape /*, double scale [=1.0] */, int lower_tail, int log_p) { |
| 50 | #ifdef IEEE_754 |
| 51 | if (ISNAN(x) || ISNAN(shape)) |
| 52 | return x + shape + 1.0; |
| 53 | #endif |
| 54 | if (shape <= 0) return R_NaN; |
| 55 | |
| 56 | if (x <= 0) |
| 57 | return R_DT_0; |
| 58 | x = -::pow(x , shape); |
| 59 | if (lower_tail) |
| 60 | return (log_p |
| 61 | /* log(1 - exp(x)) for x < 0 : */ |
| 62 | ? (x > -M_LN2 ? ::log(-::expm1(x)) : ::log1p(-::exp(x))) |
| 63 | : -::expm1(x)); |
| 64 | /* else: !lower_tail */ |
| 65 | return R_D_exp(x); |
| 66 | } |
| 67 | inline double qweibull_1(double p, double shape /*, double scale [=1.0] */, int lower_tail, int log_p){ |
| 68 | #ifdef IEEE_754 |
| 69 | if (ISNAN(p) || ISNAN(shape)) |