[GRASS-dev] [GRASS GIS] #1976: r.mapcalc: Allow rounding of floating numbers
Glynn Clements
glynn at gclements.plus.com
Wed May 22 09:18:58 PDT 2013
Paulo van Breugel wrote:
> > > > The output type of round() is now the same like the input type.
> > >
> > > This changes long-standing behaviour in a way which could break scripts.
> >
> > OK. Restoring the original behaviour for round(x) is easy. But it would be
> > nice to have a round(x, y) function that preserves the data type of x in
> > order to have a possibility to avoid integer overflow.
>
> I am not sure I understand the solution proposed by Glyn, but does it mean
> we are back at the results of round always be an integer? That would be
> disappointing imho. Preserving the data type does make so much more sense.
No. With one argument, the result will be an integer, so the
long-standing behaviour will be preserved. If a second argument is
given, the result will have the same type as the second argument, so
e.g. round(x, 1.0) will return a double.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list