[GRASS5] Re: [GRASS_DE] r.mapcalc round()

Glynn Clements glynn.clements at virgin.net
Thu Jun 7 00:56:13 EDT 2001


Helena wrote:

> > Also, I'm not sure if there's much point having separate defaults for
> > FCELL and DCELL data. Does anyone know of real-world cases where the
> > actual precision exceeds that of "float" (rel. error ~= 1.2e-7)?
> 
> It is safe to assume that such data exist. Even with the accuracy of
> the current elevation measurements in cm you want the data stored
> with precision in mm and in higher elevation areas you would need 7
> digits. It is even more important for data such as curvatures or
> pollutant concentrations which can change over several magnitudes.

I'm quite sure that such data do exist, but if they only account for a
small fraction of GRASS' usage, it doesn't seem unreasonable to
require the user to explicitly set the precision in those cases.

In terms of specifics, it boils down to whether to have one
environment variable (e.g. GRASS_PRECISION) to be used for all decimal
conversions of FP values, or two variables (e.g. GRASS_FLOAT_PRECISION
and GRASS_DOUBLE_PRECISION) and select which one to use depending upon
whether FCELL or DCELL data are used.

Note that the work involved in choosing the right setting may not
always be trivial; some programs may automatically promote float to
double for internal computations. The section of the program which
outputs the results may not have any idea as to the original
precision.

The bottom line is whether the cases where DCELL data really warrant
greater precision are sufficiently common to justify doing the extra
work involved at the present time (i.e. before 5.0.0 is released).

Something needs to be done now, as there is existing code (unless it's
all been changed since the start of this discussion) which will
sometimes do the wrong thing (specifically, use of "%f" or "%.<fixed
precision>f", which will introduce significant error for small
values), with no way for the user to change it.

-- 
Glynn Clements <glynn.clements at virgin.net>



More information about the grass-dev mailing list