[GRASS-dev] isnan() in i.atcorr
Paul Kelly
paul-grass at stjohnspoint.co.uk
Tue Oct 7 04:59:08 EDT 2008
On Tue, 7 Oct 2008, Glynn Clements wrote:
> 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?
Paul
More information about the grass-dev
mailing list