Skip to content
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

Make testing macros work with NaN's #166

Open
aprokop opened this issue Dec 15, 2017 · 9 comments
Open

Make testing macros work with NaN's #166

aprokop opened this issue Dec 15, 2017 · 9 comments

Comments

@aprokop
Copy link
Collaborator

aprokop commented Dec 15, 2017

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 NaNs? @tjfulle ?

@aprokop
Copy link
Collaborator Author

aprokop commented Dec 15, 2017

It seems like a compiler issue: it passed with gfortran but failed with flang.

@aprokop
Copy link
Collaborator Author

aprokop commented Dec 15, 2017

Maybe we should test testing macros 🤔

@tjfulle
Copy link
Collaborator

tjfulle commented Dec 15, 2017

which test exactly?

@aprokop
Copy link
Collaborator Author

aprokop commented Dec 15, 2017

MultiVector's reciprocal.

@tjfulle
Copy link
Collaborator

tjfulle commented Dec 15, 2017

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.

@aprokop
Copy link
Collaborator Author

aprokop commented Dec 16, 2017

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.

@tjfulle
Copy link
Collaborator

tjfulle commented Dec 16, 2017

@aprokop , I agree. I'll put in checks while I finish up Import/Export tests.

@aprokop
Copy link
Collaborator Author

aprokop commented Dec 16, 2017

Was this fixed by#171 (which had some nan checks inside), or is it still in progress?

@tjfulle
Copy link
Collaborator

tjfulle commented Dec 16, 2017

The TEST_EQUALITY family of functions now check for NaN, but I haven’t specifically tested for NaN in any tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants