-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Documentation #54
Comments
I have come back around to this crate seeing as it had a few updates hoping that the documentation has improved a little bit, and unfortunately it doesn't seem like it. If someone created a pull request, would there be interest in this? |
I agree. I had to dig through the code to try to figure out what the arguments to the macros mean. It would be much appreciated if the documentation briefly explained what These are my notes with simplified formulas without special cases, maybe this can be a start. Disclaimer: I may be wrong! I'm sure @sebcrozet can clarify. Absolute difference: Absolute difference between values, not heeding their magnitude: Relative difference: Scales the max allowed difference with the magnitude of the numbers: ULPS (Units in Last Place): Compares the difference after interpreting the bit pattern of the floating point values as integers. Described well (although long) at https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/. Still unclear to me how to choose |
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 to1.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!
vsrelative_eq!
vsulps_eq!
. Additionally, the documentation for each macro is quite lacking (e.g.assert_relative_eq
andrelative_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 theulps_eq!
macro? Does the order matter? Because the examples show both:What if I want to assert that two results should have "
x
decimal digits in common", is this possible?The text was updated successfully, but these errors were encountered: