PRUNERS / FLiT

A project to quickly detect discrepancies in floating point computation across hardware, compilers, libraries and software.
Other
36 stars 6 forks source link

Issue133 nan compare #322

Closed mikebentley15 closed 4 years ago

mikebentley15 commented 4 years ago

Fixes #133

Description: I created a new function called flit::abs_compare(a, b) that does a little more than std::abs(a-b).

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 or NaN).

This flit::abs_compare() function is used also from flit::l2norm() to take the difference between elements before taking the square and summing. Therefore, flit::l2norm() also benefits from being able to handle inf and NaN in matching spots within the vector.

I changed data/tests/Empty.cpp to use flit::abs_compare() as the default comparison between long double values.

Documentation: Added a section in writing-test-cases.md called Default Comparison Details giving these details for both flit::abs_compare() and flit::l2norm().

Tests: Added tests to tests/flit_src/tst_flitHelpers_h.cpp for flit::abs_compare(), and made more tests for flit::l2norm().

mikebentley15 commented 4 years ago

Sorry, I need to do a documentation change showing the default comparison used in the example test code.

mikebentley15 commented 4 years ago

It's been fixed. @IanBriggs please complete your review.