Skip to main content

Rf_dnorm4

Function Rf_dnorm4 

Source
pub unsafe fn Rf_dnorm4(x: f64, mu: f64, sigma: f64, give_log: c_int) -> f64
Expand description

Normal density: dnorm(x, mean = mu, sd = sigma, log = give_log).

Rf_dnorm4 from Rmath.h (the dnorm and dnorm4 macros resolve to it). A non-zero give_log returns the log density.

§R conditions

An invalid sigma (negative) returns NaN without a warning: nmath does not report domain errors, and the “NaNs produced” warning that stats::dnorm gives comes from R’s vectorised wrapper. nmath reports other problems (precision loss, non-convergence) 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_dnorm4. Calls Rf_dnorm4_unchecked and routes through with_r_thread. Generated from source location line 1703, column 12. Generated from source file miniextendr-api/src/sys.rs.