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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#![crate_type = "lib"]
#![crate_name = "statrs"]
#![allow(clippy::excessive_precision)]
#![allow(clippy::many_single_char_names)]
#![allow(unused_imports)]
#![forbid(unsafe_code)]
#![cfg_attr(all(test, feature = "nightly"), feature(unboxed_closures))]
#![cfg_attr(all(test, feature = "nightly"), feature(fn_traits))]
#[macro_use]
extern crate approx;
#[macro_use]
extern crate lazy_static;
#[macro_export]
macro_rules! assert_almost_eq {
($a:expr, $b:expr, $prec:expr) => {
if !$crate::prec::almost_eq($a, $b, $prec) {
panic!(
"assertion failed: `abs(left - right) < {:e}`, (left: `{}`, right: `{}`)",
$prec, $a, $b
);
}
};
}
pub mod consts;
pub mod distribution;
pub mod euclid;
pub mod function;
pub mod generate;
pub mod prec;
pub mod statistics;
mod error;
#[inline(always)]
pub(crate) fn is_zero(x: f64) -> bool {
ulps_eq!(x, 0.0, max_ulps = 0)
}
#[cfg(test)]
mod testing;
pub use crate::error::StatsError;
pub type Result<T> = std::result::Result<T, StatsError>;