[GRASS-dev] [GRASS GIS] #1976: r.mapcalc: Allow rounding of floating numbers

GRASS GIS trac at osgeo.org
Sun May 19 06:35:28 PDT 2013

#1976: r.mapcalc: Allow rounding of floating numbers
 Reporter:  pvanbosgeo   |       Owner:  grass-dev@…              
     Type:  enhancement  |      Status:  new                      
 Priority:  normal       |   Milestone:  7.0.0                    
Component:  Raster       |     Version:  unspecified              
 Keywords:  r.mapcalc    |    Platform:  Unspecified              
      Cpu:  Unspecified  |  

Comment(by mmetz):

 Replying to [ticket:1976 pvanbosgeo]:
 > The round() function in r.mapcalc always returns an integer, regardless
 of its argument types. Integers are always 32-bit, so the result is
 limited to the range +/- 2147483647 (2^31-1).
 > Suggestion: extend the function to allow to round numbers outside the
 integer range, and to round with a specific number of decimal places, like
 e.g., the function round() in R.

 Try trunk r56313.

 The output type of round() is now the same like the input type. Rounding
 to a given number of decimal places is supported with round(x, y) with y =
 number of decimal places. The new function round(x, y) supports a negative
 number of decimal places: for example, round(119, -1) results in 120, and
 round(119, -2) results in 100.

Ticket URL: <http://trac.osgeo.org/grass/ticket/1976#comment:2>
GRASS GIS <http://grass.osgeo.org>

More information about the grass-dev mailing list