-
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
Issue133 nan compare #322
Merged
Merged
Issue133 nan compare #322
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The tests fail because of the naive implementation
Tests now pass
mikebentley15
added
bug
c++
Involves touching c++ code
documentation
Involves touching documentation
tests
Involves touching tests
labels
Feb 26, 2020
Sorry, I need to do a documentation change showing the default comparison used in the example test code. |
Was causing TravisCI to fail since its compiler only has C++11 support and not C++17 support
IanBriggs
reviewed
Feb 26, 2020
Remove comment on details that have been removed No longer return inf if expected is NaN and actual is inf. It was not a symmetric relationship, so removed.
It's been fixed. @IanBriggs please complete your review. |
IanBriggs
approved these changes
Feb 26, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
c++
Involves touching c++ code
documentation
Involves touching documentation
tests
Involves touching tests
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #133
Description:
I created a new function called
flit::abs_compare(a, b)
that does a little more thanstd::abs(a-b)
.a
andb
are bothNaN
with the same sign, return0.0
a
andb
are bothinf
with the same sign, return0.0
This is to be a better default comparison function that will not fail if both test and baseline values match (even if they are
inf
orNaN
).This
flit::abs_compare()
function is used also fromflit::l2norm()
to take the difference between elements before taking the square and summing. Therefore,flit::l2norm()
also benefits from being able to handleinf
andNaN
in matching spots within the vector.I changed
data/tests/Empty.cpp
to useflit::abs_compare()
as the default comparison betweenlong double
values.Documentation:
Added a section in
writing-test-cases.md
calledDefault Comparison Details
giving these details for bothflit::abs_compare()
andflit::l2norm()
.Tests:
Added tests to
tests/flit_src/tst_flitHelpers_h.cpp
forflit::abs_compare()
, and made more tests forflit::l2norm()
.