[GRASS-SVN] r37727 - grass/branches/releasebranch_6_4/lib/gis
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jun 3 22:24:35 EDT 2009
Author: hamish
Date: 2009-06-03 22:24:35 -0400 (Wed, 03 Jun 2009)
New Revision: 37727
Modified:
grass/branches/releasebranch_6_4/lib/gis/wind_format.c
Log:
if the programmer has lied to G_format_resolution() about the
projection type in order to get FP values for lat/lon coords,
"%.8f" is not enough to preserve fidelity once converted
back into D:M:S, which leads to rounding errors. (bug #335)
merge from devbr6
Modified: grass/branches/releasebranch_6_4/lib/gis/wind_format.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/gis/wind_format.c 2009-06-04 02:23:42 UTC (rev 37726)
+++ grass/branches/releasebranch_6_4/lib/gis/wind_format.c 2009-06-04 02:24:35 UTC (rev 37727)
@@ -91,7 +91,14 @@
static int format_double(double value, char *buf)
{
- sprintf(buf, "%.8f", value);
+ /* if the programmer has lied to G_format_resolution() about the
+ projection type in order to get FP values for lat/lon coords,
+ "%.8f" is not enough to preserve fidelity once converted
+ back into D:M:S, which leads to rounding errors. */
+ if (G_projection() == PROJECTION_LL)
+ sprintf(buf, "%.15g", value);
+ else
+ sprintf(buf, "%.8f", value);
G_trim_decimal(buf);
return 0;
More information about the grass-commit
mailing list