[GRASS-dev] isnan() in i.atcorr
Glynn Clements
glynn at gclements.plus.com
Tue Oct 7 06:03:30 EDT 2008
Paul Kelly wrote:
> >> main.cpp includes <cmath>; I wonder if the problem is due to the fact
> >> isnan() is a C99 function? Should it be changed?
> >
> > Yes. This came up about a month ago:
> >
> > http://lists.osgeo.org/pipermail/grass-dev/2008-September/039910.html
> >
> > I thought it had been fixed already.
>
> On closer inspection (and using a comment in the code as a hint), I think
> i.atcorr is using isnan() where it wants to be using G_is_f_null_value(),
> i.e. this:
> /* TODO: use G_set_f_null_value()?? */
> if(vis && isnan(vis[col]) || alt && isnan(alt[col]) || isnan(buf[col])) {buf[col] = FP_NAN; continue;}
> should really be:
> if(vis && G_is_f_null_value(&vis[col]) ||
> alt && G_is_f_null_value(&alt[col]) ||
> G_is_f_null_value(&buf[col]))
> {
> G_set_f_null_value(&buf[col], 1);
> continue;
> }
>
> Any objections to me committing this?
None here.
FWIW, I've changed G_is_[fd]_null_value() to treat all NaNs as nulls,
not just the all-ones bit pattern.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list