Skip to main content

Rf_pnorm5

Function Rf_pnorm5 

Source
pub unsafe fn Rf_pnorm5(
    x: f64,
    mu: f64,
    sigma: f64,
    lower_tail: c_int,
    log_p: c_int,
) -> f64
Expand description

Normal distribution function: pnorm(x, mean = mu, sd = sigma, lower.tail = lower_tail, log.p = log_p).

Rf_pnorm5 from Rmath.h (the pnorm and pnorm5 macros resolve to it). lower_tail = 0 computes the upper tail P[X > x] directly (accurate far into the tail, unlike 1 - P[X <= x]); a non-zero log_p returns the log probability.

§R conditions

An invalid sigma (negative) returns NaN without a warning (nmath does not report domain errors). nmath reports other problems through R’s warning(), and under options(warn = 2) a warning becomes an R error, which longjmps. Call this where such a longjmp is caught: a #[miniextendr] function body, or with_r_unwind_protect. #[r_ffi_checked] gives thread routing and checking only, not an unwind guard. Checked wrapper for Rf_pnorm5. Calls Rf_pnorm5_unchecked and routes through with_r_thread. Generated from source location line 1723, column 12. Generated from source file miniextendr-api/src/sys.rs.