-
Notifications
You must be signed in to change notification settings - Fork 6
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
implement epsilon-based floating point number comparisons in tests #46
Comments
More failures:
|
BTW, in some cases it's fine to simplify the tests. E.g., if a test returns a pair of a float and a list of floats often it's enough to check the first float to pin the test result, because the list is printed out of curiosity, not because it's independent enough component of the result to be worth verifying. Or the test can be tweaked so that the list is summed and often the probability of us getting exactly the same sum from a wrong list is not worth considering. |
In the above PR (#57) I implemented |
Thank you, I will have a look.
So you confirm this. Indeed, I couldn't believe that's true. Is there a package built on top of Tasty or Test.Tasty.HUnit that implements that? Any ticket in their bugtracker? Do alternative testing packages supports that? I know of spec and https://github.com/NorfairKing/sydtest as possible contenders to Tasty, but I haven't checked in a while. |
@Mikolaj how do you like their answer? The main maintainer (Roman) seems to be in the Ukrainian military now. |
Oh dear. Regarding |
Yes we can do it like this: 56663a4 . Is it cool? |
I think that's acceptable. We are hackers after all, transitivity of The wrapping of stuff in Precision5, though, is noisy. I suppose we'd define our own |
our own operator? where? inside |
I'd think you can easily define your function/operator of choice that calls P.S.: Equality on floats: We all suffer from many years of indoctrination in high school where they taught us there was a concept of equality on reals, when there is really none (from the perspective of computing). But doing away with equality on reals would be a nightmare for mathematicians, so they rather push it onto us... [sorry for the rant] |
@Mikolaj how about this: https://github.com/Mikolaj/horde-ad/pull/57/files#diff-a78806a9b87bdb9a4a9f67dfe9b566d0daed05f8f153b835a6ad49a3c2a71247R157 . Our |
Given that this lives in IO, could it get the epsilon from, say, commandline? |
Do you mean a commandline argument, like here: https://github.com/Mikolaj/horde-ad/pull/57/files#diff-78fe67374a9d4d8a20b6f836d420d2299f903f2167d98408e9c86cfb46ac8aaeR40 ? Yes we can do it like that, the only problem is that we have to propagate our Or did you mean asking the user during the run? IMHO that would be even more ugly and wouldn't work well in batch mode. |
Yes, definitely the first option. I haven't given this much thought, but how about an IORef for the epsilon that gets updated with the commandline parameter and is read by |
Yes I was thinking about |
This, regrettably, uses the |
Depending on the architecture and/or platform, we're sometimes getting test errors like:
This shows we need more relaxed floating point value equality checks in tests. Perhaps something like:
abs(x-y) < ε
, whereε
should be configurable.Within the scope of this ticket is:
ε
mechanismε
configurableε
Related issue: #47
The text was updated successfully, but these errors were encountered: