[GRASS-user] Re: Strange r.mapcalc results
Glynn Clements
glynn at gclements.plus.com
Thu Sep 24 19:13:04 EDT 2009
Hermann Peifer wrote:
> Thanks indeed for the enlightening. I am new to the mapcalc business and
> my obviously wrong (AWK-based) thinking was that mapcalc would do a lazy
> evaluation of the conditions, i.e. "1 && 1 || something" would always
> be 1, whatever "something" was. Now I know better.
r.mapcalc never does "short-circuit" evaluation. This is true for if()
and ?: as well as &&,||,&&&,|||.
&& and || propagate nulls, while &&& and ||| return non-null where
possible. All four operators are symmetric, so e.g. "null() ||| 1" and
"1 ||| null()" both evaluate to 1.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-user
mailing list