NAN and complex.h

View: New views
1 Messages — Rating Filter:   Alert me  

NAN and complex.h

by TOMAZ :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi I made a program which basically averages data from a file. The data is stored as complex float and I'm reading it with fread with no problem. Some data are taged as NAN (at least ENVI, an image procesing soft read these values as NAN). If I average the whole data adding a number with a NAN gives me a NAN and my whole program fails.

What I did is the folowing which doesn't seems to work:

if(cabsf(zhhzhh)!= NAN)
{
    printf("%f\n", cabsf(zhhzhh));
}

For some reason the test seeams to be positive all the time, I keep printing NAN's ("nan" actualy).

Any idea?

  Tomas