FW: NAN and complex.h

=?ks_c_5601-1987?B?wMzBvrnO?= <[email protected]>
Newsgroups org.kernel.vger.linux-c-programming
Message-ID <D9FA32E4672744FA8FA42D9CE4309C24@OrangeMini>
 

-----Original Message-----
From: [email protected] [mailto:linux-c-programming-
[email protected]] On Behalf Of Lukasz Mielicki
Sent: Monday, September 24, 2007 3:31 PM
To: [email protected]
Subject: Re: NAN and complex.h

> 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?

use isnan or isfinite to check for wrong values

BX
-
To unsubscribe from this list: send the line "unsubscribe linux-c-
programming" in the body of a message to [email protected] More
majordomo info at  http://vger.kernel.org/majordomo-info.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.