use slatec_sys::special::error as raw;
use super::{SpecialFunctionError, runtime};
pub fn erf(x: f64) -> Result<f64, SpecialFunctionError> {
runtime::finite("erf", "x", x)?;
let _guard = runtime::lock_fnlib();
let mut x = x;
Ok(unsafe { raw::derf(&mut x) })
}
pub fn erfc(x: f64) -> Result<f64, SpecialFunctionError> {
runtime::finite("erfc", "x", x)?;
let _guard = runtime::lock_fnlib();
let mut x = x;
Ok(unsafe { raw::derfc(&mut x) })
}
#[cfg(feature = "special-f32")]
pub fn erf_f32(x: f32) -> Result<f32, SpecialFunctionError> {
runtime::finite_f32("erf_f32", "x", x)?;
let _guard = runtime::lock_fnlib();
let mut x = x;
Ok(unsafe { raw::erf(&mut x) })
}
#[cfg(feature = "special-f32")]
pub fn erfc_f32(x: f32) -> Result<f32, SpecialFunctionError> {
runtime::finite_f32("erfc_f32", "x", x)?;
let _guard = runtime::lock_fnlib();
let mut x = x;
Ok(unsafe { raw::erfc(&mut x) })
}