[GRASS5] Re: [GRASSLIST:205] Re: Sum for an area

Hamish hamish_nospam at yahoo.com
Sat Mar 18 23:15:32 EST 2006


> >r.univar too; any thoughts from the list on if r.univar should report
> >sum in full instead of shortening to 1.23456e+07?
> 
> To me a shortened value doesn't make much sense.


Ok, updated in CVS:

+    char sum_str[100];

+    sprintf(sum_str, "%.10f", sum);
+    G_trim_decimal(sum_str);

-       fprintf(stdout, "sum: %g\n", sum);
+       fprintf(stdout, "sum: %s\n", sum_str);



G_trim_decimal() could be used elsewhere.. e.g. if you import easting
and northings in columns with v.in.ascii, then use the d.what.vect form
you get 0.000000 everywhere and %g will convert to +e06 fomat.
?

question:
  will "%.15g" do the same job, just as well?



Hamish




More information about the grass-dev mailing list