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

Glynn Clements glynn.clements at virgin.net
Mon Jun 7 19:11:36 EDT 2004


Maciek Sieczka wrote:

> I suppose I found a bug in r.mapcalc
> (but I hope I didn't :))
> 
> I'm still in Grass 5.03 so if this is already fixed in newer release please
> forgive me for taking you time
> 
> the problem: when working with really big numbers r.mapcalc lies if you
> don't add an ".0" after a number you input:

A string of digits without a decimal point is interpreted as an
integer, which has a range of -2147483648 to 2147483647.

If you add ".0" to the end (or even just "."), it will be interpreted
as a double-precision (64-bit) floating point value, which has a range
of approximately +/- 1.8e+308 with a precision of around 15 decimal
digits.

Also, you can specify a single-precision (32-bit) floating point value
(range of approximately +/- 3.4e+38, with a precision of around 6
decimal digits) by appending "f" or "F" to the value, e.g. "1.2f".

This is intentional behaviour. If you wish to specify a floating-point
constant, you have to include the decimal point.

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




More information about the grass-user mailing list