<div dir="ltr"><div>Hi Glynn and Rainer<br><br></div>Happy to see this exchange of ideas. It would be great if this could be implemented. Do you think it is useful I make a feature request on the bug tracker (with link to this email thread) so the idea doesn't get lost?<br>
<br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, May 17, 2013 at 4:38 PM, Glynn Clements <span dir="ltr"><<a href="mailto:glynn@gclements.plus.com" target="_blank">glynn@gclements.plus.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
Rainer M. Krug wrote:<br>
<br>
> > One option is to modify round() to take a second argument (defaulting<br>
> > to 1), and have it return the first argument rounded to the nearest<br>
> > multiple of the second. The return type would be that of the second<br>
> > argument, i.e. round(x,1) rounds to the nearest integer and returns an<br>
> > integer, round(x,1.0) rounds to the nearest integer and returns a<br>
> > float, round(x,1e-3) would round to 3 decimal places (i.e. the nearest<br>
> > multiple of 0.001), etc.<br>
><br>
> Sounds like a sensible approach without adding to many new<br>
> functions. But I would actually split the two, i.e. have two more<br>
> arguments, where one specifies the type,<br>
> and the other one the number of decimals to round to, i.e.<br>
><br>
> round(x, 0, "I") would be the default, rounding to whole number and<br>
> return an integer<br>
<br>
</div>That interface isn't possible. r.mapcalc doesn't have a string type,<br>
and there's no way that a function's return type can depend upon the<br>
value of a parameter.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Glynn Clements <<a href="mailto:glynn@gclements.plus.com">glynn@gclements.plus.com</a>><br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
grass-dev mailing list<br>
<a href="mailto:grass-dev@lists.osgeo.org">grass-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/grass-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-dev</a><br>
</div></div></blockquote></div><br></div>