[Gvsig_english] Expression to calculate a field
"Jose Manuel Vivó Arnal ( Chema )
"Jose Manuel Vivó Arnal ( Chema )
Mon Jan 24 08:25:07 CET 2011
Hi! David:
Try it:
round(area()/100.0)/100.0
Calculator tries to coerce result:
349/100 (int/int) --> 3 (int)
Regards,
Chema.
El 21/01/11 18:09, David L escribió:
> Hi!
>
> I'm using gvSIG to calculate crop area. i draw polygon then i calculate a
> field (float) to obtain the area in hectares rather then square meters, with
> 2 decimals.
>
> Actually the function round(), doesn't accept a number of decimal in
> parameter.
> So I use this formula :
>
> round(area()/100)/100
>
> suppose that area() = 34899.993 m2
> According to mathematical rules:
> round(34899.993/100)/100
> round(348.99993)/100
> 349/100
> 3.49 ha
>
> in fact the expression return 3 ha
>
> is it a bug, or maybe i don't understand how the calculating expression
> behaves.
>
> I found a way to bypass this, calculating in 2 consecutives expressions.
> round(area()/100)
>
> then
> [area_ha]/100
>
> I tought that this could be correct in a next revision and it would be great
> to directly assign a number of decimals at the round() function.
> round((area()/10000),2)
>
> regards
>
> David
>
>
>
>
>
--
Jose Manuel Vivó Arnal
DiSiD Technologies S.L. (http://www.disid.com)
More information about the Gvsig_internacional
mailing list