[geos-devel] Re: Strange problem with ISNAN macro
=?GB2312?B?zfXTwL3c?=
wang.yongjie.2008 at gmail.com
Wed May 7 22:48:35 EDT 2008
Hello Ciao:
I try to test the return value of ISNAN(DoubleNotANumber), it's true
that always failure.
The macro ISNAN is defined with function _isnan what returns a nonzero
value if the argument x is a NAN,
There are two methods to generate NAN.
1. this method is come from MSDN.
unsigned long nan[2]={0xffffffff, 0x7fffffff};
double g = *( double* )nan;
g is NAN, and ISNAN(g) will return true.
2. the other method is come from stl
double g = numeric_limits<double>::quiet_NaN();
g is NAN too, and ISNAN(g) will return true.
it's seems that DoubleNotANumber define with 1.7e-308 is not NAN.
does this can solve your problem.
Best regards to everyone.
> ------------------------------
>
> Message: 2
> Date: Wed, 7 May 2008 11:58:44 +0200
> From: "Simone Giannecchini" <simone.giannecchini at geo-solutions.it>
> Subject: [geos-devel] Strange problem with ISNAN macro
> To: geos-devel at lists.osgeo.org
> Message-ID:
> <961f4d9e0805070258i557340a7qef736bcc1176d189 at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi list,
> I am resurrecting some old code (1.5 years almost) which depended on a
> previous version of GEOS and I am having a strange problem.
> My code was used on windows platforms without (apparent :-) )
> problems. I have some wrapper classes of Coordinate where I make use
> of the ISNAN(x) macro defined in platform.h.
> I have built my app against GEOS 3.0 on an intel win xp pro using vs
> 7.1 but now strange enough, in my code this test
> ISNAN(DoubleNotANumber) always fails, causing me quite a lot of
> headaches.
> I have not investigated this problem too much yet, hence the solutions
> might be simple and immediate, if so, I apologize in advance! :-)
>
> Does anyone have an idea about how to tackle this problem?
>
>
> Ciao,
> Simone.
>
> --
> -------------------------------------------------------
> Eng. Simone Giannecchini
> President /CEO GeoSolutions S.A.S.
> Via Carignoni 51
> 55041 Camaiore (LU)
> Italy
>
> phone: +39 0584983027
> fax: +39 0584983027
> mob: +39 333 8128928
>
>
> http://www.geo-solutions.it
>
> -------------------------------------------------------
>
>
--
Wang Yongjie
Tel: +86(10)8282 5800 Ext. 8411
Fax: +86(10)8282 5816
Email: yongjiemail at gmail.com
MSN/Gtalk: yongjiemail at gmail.com
Blog: www.iseeker.org/blog
More information about the geos-devel
mailing list