2008/5/19 Glynn Clements <[EMAIL PROTECTED]>: > > Yann Chemin wrote: > > > I have some data that reads as "nan", while rare, it may happen when > > compressing/uncompressing GRASS Locations to ship them across > > Internet. > > > > I would like to know how to deal with them in GRASS raster > > programming, so that they are: > > 1 - detected > > 2 - set to null > > if (x != x) > G_set_d_null_value(&x, 1); >
Sounds simple enough. > > There is also isnan(), which is in C99, and also specified by POSIX: > > http://www.opengroup.org/onlinepubs/009695399/functions/isnan.html > > However, I don't know if it exists on all platforms which we care > about. MSDN says that MSVCRT has _isnan() (with a leading underscore), > but it's defined in <float.h> rather than <math.h>. > hmm... ok > > The (x != x) test should be portable; OTOH, it's the kind of thing > that compilers often get wrong, particularly when optimising (if you > ignore NaN, x!=x is always false). > OK, this is a pickle... I'll give it a try and see what it does here. > > For 7.0, I intend to change G_is_[fd]_null_value() to treat all NaN > values as null, not just the specific bit patterns which it currently > uses. > This would be good indeed. > > -- > Glynn Clements <[EMAIL PROTECTED]> > -- Yann Chemin International Rice Research Institute Office: http://www.irri.org/gis Perso: http://www.freewebs.com/ychemin
_______________________________________________ grass-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/grass-dev
