Reasons for NaN in a C ++ Application That Don't Raise a Floating Point Exception

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?

+5
source share
2 answers

- NaN, , , , NaN .

, (, , ), NaN. , 0xffff... NaN.

+5

? , sqrt (-1), Nan. " ". , ? , - .

0

All Articles