Skip to content

Commit

Permalink
fix: handle assertions for inf in prec::almost_eq
Browse files Browse the repository at this point in the history
  • Loading branch information
YeungOnion committed Jun 6, 2024
1 parent 7fa8336 commit e8e9c61
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/prec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ pub const DEFAULT_F64_ACC: f64 = 0.0000000000000011102230246251565;
/// Compares if two floats are close via `approx::abs_diff_eq`
/// using a maximum absolute difference (epsilon) of `acc`.
pub fn almost_eq(a: f64, b: f64, acc: f64) -> bool {
if a.is_infinite() && b.is_infinite() {
return true;
}
a.abs_diff_eq(&b, acc)
}

Expand Down

0 comments on commit e8e9c61

Please sign in to comment.