Announcing `float_eq` 0.5.0


I've just published version 0.5.0 of float_eq, for comparing floating point values.

This release adds additional relative comparison modes which scale the given epsilon to the granularity of one of the inputs:

// Scales max_diff by the larger magnitude of a and b
assert_float_eq!(a, b, rmax <= max_diff);

// Scales max_diff by the smaller magnitude of a and b
assert_float_eq!(a, b, rmin <= max_diff);

// Scales max_diff by the magnitude of a
assert_float_eq!(a, b, r1st <= max_diff);

// Scales max_diff by the magnitude of b
assert_float_eq!(a, b, r2nd <= max_diff);

The extension traits are now specified in terms much closer to their intended use and I hope this makes it easier to extend comparison over custom types.

I have also rewritten much of the documentation to be more streamlined and direct.

Barring a big issue popping up in the near future, the crate should now be considered stable, this is the version that is intended to become 1.0.0. I am therefore particularly interested in any issues you may have in terms of missing or difficult to use features, or areas you think the documentation could use improvement. Either way, I hope you have a wonderful day :slight_smile:

How does float_eq differ from approx?

Both provide similar comparison capabilities, with different underlying philosophies and APIs, see this post for a longer discussion.


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.