MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / dweibull_1

Function dweibull_1

inst/include/Rcpp/stats/weibull.h:30–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28namespace stats {
29
30inline double dweibull_1(double x, double shape /*, double scale [=1.0] */ , int give_log){
31 double tmp1, tmp2;
32#ifdef IEEE_754
33 if (ISNAN(x) || ISNAN(shape))
34 return x + shape + 1.0;
35#endif
36 if (shape <= 0) return R_NaN;
37
38 if (x < 0) return R_D__0;
39 if (!R_FINITE(x)) return R_D__0;
40 /* need to handle x == 0 separately */
41 if (x == 0 && shape < 1) return ML_POSINF;
42 tmp1 = ::pow(x, shape - 1);
43 tmp2 = tmp1 * x;
44 /* These are incorrect if tmp1 == 0 */
45 return give_log ?
46 -tmp2 + ::log(shape * tmp1) :
47 shape * tmp1 * ::exp(-tmp2);
48}
49inline 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))

Callers

nothing calls this directly

Calls 3

powFunction · 0.85
logFunction · 0.50
expFunction · 0.50

Tested by

no test coverage detected