1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#![link_name = "m"]

use libc::{c_double, c_int};

extern "C" {
    pub fn erf(x: c_double) -> c_double;
    pub fn erfc(x: c_double) -> c_double;
    pub fn tgamma(x: c_double) -> c_double;
}

#[cfg(windows)]
extern "C" {
    pub fn lgamma(x: c_double, sign: &mut c_int) -> c_double;
}

#[cfg(unix)]
extern "C" {
    pub fn lgamma_r(x: c_double, sign: &mut c_int) -> c_double;
}

#[cfg(unix)]
#[inline(always)]
pub unsafe fn lgamma(x: c_double, sign: &mut c_int) -> c_double {
    lgamma_r(x, sign)
}