calcucalc 0.2.1

A general-purpose calculus library written in Rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/// Checks if two f64 values are equal within a specified tolerance.
///
/// ```rust
/// use calcucalc::math_helpers::is_equal_within_tolerance_to;
///
/// let a = 0.1 + 0.2;
/// let b = 0.3;
/// assert!(is_equal_within_tolerance_to(&a, &b));
/// ```
#[must_use]
pub fn is_equal_within_tolerance_to(a: &f64, b: &f64) -> bool {
    let tolerance = 1e-10;
    (a - b).abs() < tolerance
}