pub fn approx_equal(a: &[f32], b: &[f32], epsilon: f32) -> boolExpand description
Checks if two vectors are approximately equal within a tolerance.
This function performs element-wise comparison with the specified epsilon value to account for floating-point precision issues.
§Arguments
a- First vectorb- Second vectorepsilon- Maximum allowed difference per component
§Returns
Returns true if all corresponding elements differ by at most epsilon,
false otherwise. Returns false if dimensions don’t match.
§Examples
use foxstash_core::vector::ops::approx_equal;
let a = vec![1.0, 2.0, 3.0];
let b = vec![1.0001, 2.0001, 3.0001];
assert!(approx_equal(&a, &b, 0.001));
assert!(!approx_equal(&a, &b, 0.00001));