[GRASSLIST:3655] Re: r.mapcalc - zero point bug

Glynn Clements glynn.clements at virgin.net
Thu Jun 10 04:29:19 EDT 2004


Maciek Sieczka wrote:

> > The syntax and semantics of r.mapcalc expressions significantly
> > resemble those of the C language, which is probably the most
> > widely-known programming language. I would guess that this was
> > intentional.
> >...
> > The r.mapcalc manpage says:
> > ...
> 
> sorry, I should have read the r.mapcalc man more carefully, some of my
> problems are explained there
> propably I was too tired to see it
> 
> anyway - I just assumed that numbers are numbers i.e 1 and 1.0 are exactly
> the same like they told me at school
> 
> stupid me
> 
> but not everybody knows C and it's conventions
> many don't know any programming language

Well, r.mapcalc is essentially a programming language, albeit a fairly
simple one. Although, we should really provide a more detailed
explanation for users with no prior programming experience.

OTOH, the distinction between integers and real (or floating-point)
numbers isn't restricted to C. Most programming languages make this
distinction, as does mathematics ("discrete" mathematics versus the
rest of it).

Also, the convention that "1" is an integer while "1.0" is a real is
almost as common. Some languages would treat "1.0" as a real but
determine whether "1" is integer or real based upon context, although,
in practice, this can create as many problems as it solves (I'll leave
it at that; discussions among programmers as to whether context
dependence is good or bad often degenerate into a flame-war).

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




More information about the grass-user mailing list