[GRASS-user] Precision of raster/vector float values

Glynn Clements glynn at gclements.plus.com
Thu Aug 23 14:43:00 PDT 2012


Markus Metz wrote:

> > I have a GRASS raster map which contains small values (e.g 2.5e-15) among
> > others.
> 
> This is (dangerously) close to the IEEE limit of double precision
> floating point values. If GRASS tests for fp precision, it regards
> (absolute) values smaller than 1.0e-15 (GRASS_EPSILON) as zero.

2.5e-15 is close to the "epsilon" value for IEEE double precision. 
This just means that (1.0 + 2.5e-15) is only barely distinguishable
from 1.0. It has no relevance to the representation of small numbers. 
A double can represent numbers as low as ~2.225e-308 with no loss of
precision.

If GRASS_EPSILON is being used to compare absolute (rather then
relative) difference, that's a bug.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list