[GRASS-SVN] r45696 - grass/branches/develbranch_6/raster/r.reclass

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Mar 17 19:00:39 EDT 2011


Author: hamish
Date: 2011-03-17 16:00:39 -0700 (Thu, 17 Mar 2011)
New Revision: 45696

Modified:
   grass/branches/develbranch_6/raster/r.reclass/main.c
Log:
export floats and doubles with correct precision (#335)

Modified: grass/branches/develbranch_6/raster/r.reclass/main.c
===================================================================
--- grass/branches/develbranch_6/raster/r.reclass/main.c	2011-03-17 22:13:19 UTC (rev 45695)
+++ grass/branches/develbranch_6/raster/r.reclass/main.c	2011-03-17 23:00:39 UTC (rev 45696)
@@ -27,7 +27,7 @@
     struct Categories cats;
     struct FPRange range;
     DCELL min, max;
-    int fp;
+    RASTER_MAP_TYPE map_type;
     char buf[1024];
     RULE *rules, *tail;
     int any;
@@ -94,7 +94,7 @@
     tty = isatty(fileno(srcfp));
 
     G_init_cats(0, "", &cats);
-    fp = G_raster_map_is_fp(parm.input->answer, old_mapset);
+    map_type = G_raster_map_type(parm.input->answer, old_mapset);
     G_read_fp_range(parm.input->answer, old_mapset, &range);
     G_get_fp_range_min_max(&range, &min, &max);
     rules = tail = NULL;
@@ -103,11 +103,14 @@
     if (tty) {
 	fprintf(stdout,
 		_("Enter rule(s), \"end\" when done, \"help\" if you need it\n"));
-	if (fp)
-	    fprintf(stdout, _("fp: Data range is %.25f to %.25f\n"),
+	if (map_type == FCELL_TYPE)
+	    fprintf(stdout, _("FCELL: Data range is %.7g to %.7g\n"),
 		    (double)min, (double)max);
+	else if (map_type == DCELL_TYPE)
+	    fprintf(stdout, _("DCELL: Data range is %.15g to %.15g\n"),
+                    (double)min, (double)max);
 	else
-	    fprintf(stdout, _("Data range is %ld to %ld\n"), (long)min,
+	    fprintf(stdout, _("CELL: Data range is %ld to %ld\n"), (long)min,
 		    (long)max);
     }
 



More information about the grass-commit mailing list