Skip to content

Commit e8e9c61

Browse files
committed
fix: handle assertions for inf in prec::almost_eq
1 parent 7fa8336 commit e8e9c61

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/prec.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ pub const DEFAULT_F64_ACC: f64 = 0.0000000000000011102230246251565;
1212
/// Compares if two floats are close via `approx::abs_diff_eq`
1313
/// using a maximum absolute difference (epsilon) of `acc`.
1414
pub fn almost_eq(a: f64, b: f64, acc: f64) -> bool {
15+
if a.is_infinite() && b.is_infinite() {
16+
return true;
17+
}
1518
a.abs_diff_eq(&b, acc)
1619
}
1720

0 commit comments

Comments
 (0)