linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Lukasz Mielicki" <lukasz.mielicki@tahoe.pl>
To: linux-c-programming@vger.kernel.org
Subject: Re: NAN and complex.h
Date: Mon, 24 Sep 2007 08:31:23 +0200	[thread overview]
Message-ID: <014001c7fe74$87112e20$2214a8c0@tahoec> (raw)
In-Reply-To: 12766829.post@talk.nabble.com

> 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 

      parent reply	other threads:[~2007-09-24  6:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-18 21:52 NAN and complex.h TOMAZ
2007-09-18 22:21 ` Glynn Clements
2007-09-24  6:31 ` Lukasz Mielicki [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='014001c7fe74$87112e20$2214a8c0@tahoec' \
    --to=lukasz.mielicki@tahoe.pl \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).