[GRASS-SVN] r54937 - grass/trunk/lib/raster

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


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

Modified:
   grass/trunk/lib/raster/color_write.c
Log:
libraster: fix fp precision export

Modified: grass/trunk/lib/raster/color_write.c
===================================================================
--- grass/trunk/lib/raster/color_write.c	2013-02-05 16:27:31 UTC (rev 54936)
+++ grass/trunk/lib/raster/color_write.c	2013-02-05 16:40:09 UTC (rev 54937)
@@ -125,7 +125,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);
     }
@@ -172,7 +172,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);
@@ -183,7 +183,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);
@@ -245,16 +245,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));
     }
 }
 
@@ -263,15 +263,15 @@
 {
     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));
     }
 }



More information about the grass-commit mailing list