To find the reason for the occurrence of floating point variables in NaN in my C ++ program, I included floating point exceptions, such as:
#include <fenv.h>
feenableexcept(FE_INVALID | FE_OVERFLOW);
I know this works because when I write:
int val = 0.0/0.0;
a floating point exception occurs in my program. But NaNs “propagate” according to the floating point calculations of my program, and I don’t know which variable is set to NaN in the first place.
What are the reasons for the beeing variable set to NaN that would not throw a floating point exception?
source
share