[GRASS-dev] [GRASS GIS] #1976: r.mapcalc: Allow rounding of floating numbers
Rainer M. Krug
Rainer at krugs.de
Mon May 20 02:29:28 PDT 2013
"GRASS GIS" <trac at osgeo.org> writes:
> #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.
<#secure method=pgpmime mode=sign>
Great - sounds like a perfect solution to me.
Thanks,
Rainer
--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)
Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa
Tel : +33 - (0)9 53 10 27 44
Cell: +33 - (0)6 85 62 59 98
Fax : +33 - (0)9 58 10 27 44
Fax (D): +49 - (0)3 21 21 25 22 44
email: Rainer at krugs.de
Skype: RMkrug
More information about the grass-dev
mailing list