The documentation currently is not very clear as to how it computes things, and one reason I think is that nearly all the example just compare whether 1.0 is approximately equal to 1.0 which isn't very illustrative.
It would be good if there were examples at the crate level showing the differences between the various macros that illustrate when one should use abs_diff_eq! vs relative_eq! vs ulps_eq!. Additionally, the documentation for each macro is quite lacking (e.g. assert_relative_eq and relative_eq are not very helpful).
It is also unclear from the documentation what keyword arguments are allowed in which macros. Are the crate-level examples exhaustive ? Or can I also use max_relative in the ulps_eq! macro? Does the order matter? Because the examples show both:
relative_eq!(1.0, 1.0, epsilon = f64::EPSILON, max_relative = 1.0);
relative_eq!(1.0, 1.0, max_relative = 1.0, epsilon = f64::EPSILON);
What if I want to assert that two results should have "x decimal digits in common", is this possible?
The documentation currently is not very clear as to how it computes things, and one reason I think is that nearly all the example just compare whether
1.0is approximately equal to1.0which isn't very illustrative.It would be good if there were examples at the crate level showing the differences between the various macros that illustrate when one should use
abs_diff_eq!vsrelative_eq!vsulps_eq!. Additionally, the documentation for each macro is quite lacking (e.g.assert_relative_eqandrelative_eqare not very helpful).It is also unclear from the documentation what keyword arguments are allowed in which macros. Are the crate-level examples exhaustive ? Or can I also use
max_relativein theulps_eq!macro? Does the order matter? Because the examples show both:What if I want to assert that two results should have "
xdecimal digits in common", is this possible?