[Mapserver-dev] Floating point precision problem in the WMS module

Sean Gillies sgillies at frii.com
Mon May 24 09:46:52 EDT 2004


11 decimal places?  What are you doing, Dermatology? :)
Did you try strtold (long double)?

According to my standard C library (on BSD), atof is not thread safe
and has been deprecated in favor of strtod.  That was news to me.  No
mention of deprecation on my Linux system (RH9).

Sean

On May 24, 2004, at 4:40 AM, Jean-Henry Berevoescu wrote:

>
> Hi,
> I am experiencing a problem in the WMS module and I wonder
> if there is are others who know about it.
> Accessing MMS as a WMS Server the request gets parsed in
> mapwms.c: msWMSLoadGetMapParams(...)
>
> ....
>      map->extent.minx = atof(tokens[0]);
>      map->extent.miny = atof(tokens[1]);
>      map->extent.maxx = atof(tokens[2]);
>      map->extent.maxy = atof(tokens[3]);
> ....
>
> I send the WMS request with a BBOX having 10-11 digits after the 
> decimal
> points for the coordinates. Just before this part of the code I added 
> a log
> print and the BBOX coordinates are still all right (altough still as 
> strings)
> Doing the same with the value that get into the "extent", I get all the
> coordinates truncated to 6 digits after the decimal point. It is as if
> a double gets downsized to a float.
> The extent structure has doubles so the problem is not that.
> I also tried to replace "atof" with calls to strod or sscanf and the
> results are identical.
>
> Thanks in advance for any insights on how to solve this problem.
>
> Jean
>
> _______________________________________________
> Mapserver-dev mailing list
> Mapserver-dev at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-dev
>




More information about the mapserver-dev mailing list