[GRASS-SVN] r54938 - grass/branches/releasebranch_6_4/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Feb 5 08:40:29 PST 2013


Author: mmetz
Date: 2013-02-05 08:40:29 -0800 (Tue, 05 Feb 2013)
New Revision: 54938

Modified:
   grass/branches/releasebranch_6_4/lib/gis/color_write.c
Log:
libgis: fix fp precision export

Modified: grass/branches/releasebranch_6_4/lib/gis/color_write.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/gis/color_write.c	2013-02-05 16:40:09 UTC (rev 54937)
+++ grass/branches/releasebranch_6_4/lib/gis/color_write.c	2013-02-05 16:40:29 UTC (rev 54938)
@@ -121,7 +121,7 @@
     fprintf(fd, "%% %s %s\n", str1, str2);
 
     if (colors->shift) {
-	sprintf(str2, "%.15g", (double)colors->shift);
+	sprintf(str2, "%.17g", (double)colors->shift);
 	G_trim_decimal(str2);
 	fprintf(fd, "shift:%s\n", str2);
     }
@@ -169,7 +169,7 @@
 	if (rule->low.value == dmin)
 	    format_min(str, (double)rule->low.value);
 	else {
-	    sprintf(str, "%.15g", (double)rule->low.value);
+	    sprintf(str, "%.17g", (double)rule->low.value);
 	    G_trim_decimal(str);
 	}
 	fprintf(fd, "%s:%d", str, (int)rule->low.red);
@@ -180,7 +180,7 @@
 	    if (rule->high.value == dmax)
 		format_max(str, (double)rule->high.value);
 	    else {
-		sprintf(str, "%.15g", (double)rule->high.value);
+		sprintf(str, "%.17g", (double)rule->high.value);
 		G_trim_decimal(str);
 	    }
 	    fprintf(fd, " %s:%d", str, (int)rule->high.red);
@@ -246,16 +246,16 @@
 {
     double dtmp;
 
-    sprintf(str, "%.15g", dval);
+    sprintf(str, "%.17g", dval);
     /* Note that G_trim_decimal() does not trim e.g. 1.0000000e-20 */
     G_trim_decimal(str);
     sscanf(str, "%lf", &dtmp);
     if (dtmp != dval) {  /* if no zeros after decimal point were trimmed */
 	/* lower dval by GRASS_EPSILON fraction */
 	if (dval > 0)
-	    sprintf(str, "%.15g", dval * (1 - GRASS_EPSILON));
+	    sprintf(str, "%.17g", dval * (1 - GRASS_EPSILON));
 	else
-	    sprintf(str, "%.15g", dval * (1 + GRASS_EPSILON));
+	    sprintf(str, "%.17g", dval * (1 + GRASS_EPSILON));
     }
 
     return 0;
@@ -265,16 +265,16 @@
 {
     double dtmp;
 
-    sprintf(str, "%.15g", dval);
+    sprintf(str, "%.17g", dval);
     /* Note that G_trim_decimal() does not trim e.g. 1.0000000e-20 */
     G_trim_decimal(str);
     sscanf(str, "%lf", &dtmp);
     if (dtmp != dval) {  /* if  no zeros after decimal point were trimmed */
 	/* increase dval by by GRASS_EPSILON fraction */
 	if (dval > 0)
-	    sprintf(str, "%.15g", dval * (1 + GRASS_EPSILON));
+	    sprintf(str, "%.17g", dval * (1 + GRASS_EPSILON));
 	else
-	    sprintf(str, "%.15g", dval * (1 - GRASS_EPSILON));
+	    sprintf(str, "%.17g", dval * (1 - GRASS_EPSILON));
     }
 
     return 0;



More information about the grass-commit mailing list