ForTrilinos
ForTrilinos copied to clipboard
Make testing macros work with NaN's
The reciprocal
test was passing despite having the following:
TEST_FLOATING_ARRAY_EQUALITY(dots, one, epsilon(one))
Besides the fact that one
should have been one*numLocal
, the funny thing is that dots
actually had NaN
inside. However, this did not seem to fail. The question is: what is the result of abs(maxval(a-b))
when a
or b
contains NaN
s? @tjfulle ?
It seems like a compiler issue: it passed with gfortran
but failed with flang
.
Maybe we should test testing macros 🤔
which test exactly?
MultiVector's reciprocal.
To avoid this in the future I can add a check for NaN
and INF
in each testing macro that checks equality. Or, rather than add logic to every test for NaN
, perhaps we can just set the appropriate compiler flags? In gfortran: -ffpe-trap=invalid
, intel: -fpe0
. I'm not sure about nag, pgi, sun, flang, and others. But, the checks would turn off if the flags are removed.
If this is a priority, I could do this pretty quick.
I think I'd argue for updating test macros. I don't know a) how compiler flags are portable, b) would users frown upon subpackages adding to compiler flags.
@aprokop , I agree. I'll put in checks while I finish up Import/Export tests.
Was this fixed by#171 (which had some nan checks inside), or is it still in progress?
The TEST_EQUALITY
family of functions now check for NaN
, but I haven’t specifically tested for NaN
in any tests.