[GRASS-dev] r.mapcalc/r.univar and 0.0/rand

Glynn Clements glynn at gclements.plus.com
Fri Sep 15 02:47:07 EDT 2006


Maciej Sieczka wrote:

> I noticed that if I create DCELL raster by
> 
> $ r.mapcalc 'map=0.0'
> 
> the 'r.univar map' says the min. value is:
> 
> minimum: 0
> 
> But when I create a 0 DCELL raster using rand function:
> 
> $ r.mapcalc 'map=rand(0.0,2.0)'
> 
> the min. value reported by 'r.univar map' is different:
> 
> minimum: 7.81597e-14
> 
> Why this difference? I would expect "minimum: 0" in both cases.

Why? The probability of getting exactly 0.0 out of rand(0.0,2.0) is so
small as to be negligible.

The probability of any single value being exactly 0.0 is less than
1e-300, so you would need in the region of 1e300 values to have a
reasonable probability that one of them would be exactly 0.0.

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




More information about the grass-dev mailing list