diff --git a/rustfst/src/semirings/mod.rs b/rustfst/src/semirings/mod.rs index 6312db0d7..dcdf216dd 100644 --- a/rustfst/src/semirings/mod.rs +++ b/rustfst/src/semirings/mod.rs @@ -16,7 +16,6 @@ mod string_weight; mod tropical_weight; mod union_weight; pub(crate) mod utils_float; -pub use utils_float::float_approx_equal; pub use self::boolean_weight::BooleanWeight; pub use self::gallic_weight::{ diff --git a/rustfst/src/semirings/utils_float.rs b/rustfst/src/semirings/utils_float.rs index 059f25003..0fc9f14ff 100644 --- a/rustfst/src/semirings/utils_float.rs +++ b/rustfst/src/semirings/utils_float.rs @@ -1,3 +1,3 @@ -pub fn float_approx_equal(w1: f32, w2: f32, delta: f32) -> bool { - (w1 <= w2 + delta) && (w2 <= w1 + delta) +pub(crate) fn float_approx_equal(w1: f32, w2: f32, delta: f32) -> bool { + (w1 - w2).abs() <= delta }