[GRASS-SVN] r54458 - grass/trunk/vector/v.distance
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Dec 29 09:51:42 PST 2012
Author: mmetz
Date: 2012-12-29 09:51:41 -0800 (Sat, 29 Dec 2012)
New Revision: 54458
Modified:
grass/trunk/vector/v.distance/main.c
grass/trunk/vector/v.distance/print.c
Log:
v.distance: fix precision
Modified: grass/trunk/vector/v.distance/main.c
===================================================================
--- grass/trunk/vector/v.distance/main.c 2012-12-29 13:42:41 UTC (rev 54457)
+++ grass/trunk/vector/v.distance/main.c 2012-12-29 17:51:41 UTC (rev 54458)
@@ -1384,28 +1384,28 @@
sprintf(buf2, " %d", Near[i].to_cat);
break;
case DIST:
- sprintf(buf2, " %f", Near[i].dist);
+ sprintf(buf2, " %.17g", Near[i].dist);
break;
case FROM_X:
- sprintf(buf2, " %f", Near[i].from_x);
+ sprintf(buf2, " %.17g", Near[i].from_x);
break;
case FROM_Y:
- sprintf(buf2, " %f", Near[i].from_y);
+ sprintf(buf2, " %.17g", Near[i].from_y);
break;
case TO_X:
- sprintf(buf2, " %f", Near[i].to_x);
+ sprintf(buf2, " %.17g", Near[i].to_x);
break;
case TO_Y:
- sprintf(buf2, " %f", Near[i].to_y);
+ sprintf(buf2, " %.17g", Near[i].to_y);
break;
case FROM_ALONG:
- sprintf(buf2, " %f", Near[i].from_along);
+ sprintf(buf2, " %.17g", Near[i].from_along);
break;
case TO_ALONG:
- sprintf(buf2, " %f", Near[i].to_along);
+ sprintf(buf2, " %.17g", Near[i].to_along);
break;
case TO_ANGLE:
- sprintf(buf2, " %f", Near[i].to_angle);
+ sprintf(buf2, " %.17g", Near[i].to_angle);
break;
case TO_ATTR:
if (catval) {
@@ -1415,7 +1415,7 @@
break;
case DB_C_TYPE_DOUBLE:
- sprintf(buf2, " %.15e", catval->val.d);
+ sprintf(buf2, " %.17g", catval->val.d);
break;
case DB_C_TYPE_STRING:
@@ -1482,28 +1482,28 @@
sprintf(buf2, " null");
break;
case DIST:
- sprintf(buf2, " %f", Near[i].dist);
+ sprintf(buf2, " %.17g", Near[i].dist);
break;
case FROM_X:
- sprintf(buf2, " %f", Near[i].from_x);
+ sprintf(buf2, " %.17g", Near[i].from_x);
break;
case FROM_Y:
- sprintf(buf2, " %f", Near[i].from_y);
+ sprintf(buf2, " %.17g", Near[i].from_y);
break;
case TO_X:
- sprintf(buf2, " %f", Near[i].to_x);
+ sprintf(buf2, " %.17g", Near[i].to_x);
break;
case TO_Y:
- sprintf(buf2, " %f", Near[i].to_y);
+ sprintf(buf2, " %.17g", Near[i].to_y);
break;
case FROM_ALONG:
- sprintf(buf2, " %f", Near[i].from_along);
+ sprintf(buf2, " %.17g", Near[i].from_along);
break;
case TO_ALONG:
- sprintf(buf2, " %f", Near[i].to_along);
+ sprintf(buf2, " %.17g", Near[i].to_along);
break;
case TO_ANGLE:
- sprintf(buf2, " %f", Near[i].to_angle);
+ sprintf(buf2, " %.17g", Near[i].to_angle);
break;
case TO_ATTR:
if (catval) {
@@ -1513,7 +1513,7 @@
break;
case DB_C_TYPE_DOUBLE:
- sprintf(buf2, " %.15e", catval->val.d);
+ sprintf(buf2, " %.17g", catval->val.d);
break;
case DB_C_TYPE_STRING:
Modified: grass/trunk/vector/v.distance/print.c
===================================================================
--- grass/trunk/vector/v.distance/print.c 2012-12-29 13:42:41 UTC (rev 54457)
+++ grass/trunk/vector/v.distance/print.c 2012-12-29 17:51:41 UTC (rev 54458)
@@ -22,25 +22,25 @@
fprintf(stdout, "|null");
break;
case DIST:
- fprintf(stdout, "|%f", Near[i].dist);
+ fprintf(stdout, "|%.17g", Near[i].dist);
break;
case FROM_X:
- fprintf(stdout, "|%f", Near[i].from_x);
+ fprintf(stdout, "|%.17g", Near[i].from_x);
break;
case FROM_Y:
- fprintf(stdout, "|%f", Near[i].from_y);
+ fprintf(stdout, "|%.17g", Near[i].from_y);
break;
case TO_X:
- fprintf(stdout, "|%f", Near[i].to_x);
+ fprintf(stdout, "|%.17g", Near[i].to_x);
break;
case TO_Y:
- fprintf(stdout, "|%f", Near[i].to_y);
+ fprintf(stdout, "|%.17g", Near[i].to_y);
break;
case FROM_ALONG:
- fprintf(stdout, "|%f", Near[i].from_along);
+ fprintf(stdout, "|%.17g", Near[i].from_along);
break;
case TO_ALONG:
- fprintf(stdout, "|%f", Near[i].to_along);
+ fprintf(stdout, "|%.17g", Near[i].to_along);
break;
case TO_ANGLE:
fprintf(stdout, "|%f", Near[i].to_angle);
@@ -53,7 +53,7 @@
break;
case DB_C_TYPE_DOUBLE:
- fprintf(stdout, "|%.15e", catval->val.d);
+ fprintf(stdout, "|%.17g", catval->val.d);
break;
case DB_C_TYPE_STRING:
More information about the grass-commit
mailing list