rgsl/
dawson.rs

1//
2// A rust binding for the GSL library by Guillaume Gomez (guillaume1.gomez@gmail.com)
3//
4
5/*!
6The Dawson integral is defined by \exp(-x^2) \int_0^x dt \exp(t^2).
7A table of Dawson’s integral can be found in Abramowitz & Stegun, Table 7.5.
8!*/
9
10use crate::{sys, types, Value};
11use std::mem::MaybeUninit;
12
13/// This routine computes the value of Dawson’s integral for x.
14#[doc(alias = "gsl_sf_dawson")]
15pub fn dawson(x: f64) -> f64 {
16    unsafe { sys::gsl_sf_dawson(x) }
17}
18
19/// This routine computes the value of Dawson’s integral for x.
20#[doc(alias = "gsl_sf_dawson_e")]
21pub fn dawson_e(x: f64) -> Result<types::Result, Value> {
22    let mut result = MaybeUninit::<sys::gsl_sf_result>::uninit();
23    let ret = unsafe { sys::gsl_sf_dawson_e(x, result.as_mut_ptr()) };
24
25    result_handler!(ret, unsafe { result.assume_init() }.into())
26}