slatec 0.1.0

Safe Rust interface to selected SLATEC numerical routines
1
2
3
4
5
6
7
8
9
10
11
12
13
use crate::special::{SpecialFunctionError, runtime};
use slatec_sys::special::airy as raw;

/// Airy Ai for `-20 <= x <= 20`, using SLATEC `DAI`.
pub fn airy_ai(x: f64) -> Result<f64, SpecialFunctionError> {
    runtime::bounded("airy_ai", "x", x, 20.0)?;
    let _guard = runtime::lock_fnlib();
    let mut x = x;
    // Safety: the conservative range prevents the documented Airy
    // overflow/underflow error paths; the FNLIB profile and pointer ABI were
    // explicitly validated.
    Ok(unsafe { raw::dai(&mut x) })
}