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

Hi,

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.

Maciek

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@gclements.plus.com>

Glynn Clements wrote:

Maciej Sieczka wrote:

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.

Oops. That was dumb of me. Of course. Forgive me - it was late here
when I asked that question.

Best,
Maciek