<div dir="ltr"><div>Hey,</div><div><br></div>There is no left to right here, / is higher order then * so both these are the same:<div><br></div><div><div>>> exp = QgsExpression('100.0 * 50 / 2')</div><div>>> exp2 = QgsExpression('50 / 2 * 100.0')</div>

<div>>> exp.evaluate(), exp2.evaluate()</div><div>(2500.0, 2500.0)</div></div><div><br></div><div>What you are seeing is the QGIS expression engine doing the multiply part result first, which returns a float, then it will say "is the left side a int AND the right side a int" if that comes back as NO then it does a float operation.  Basically this means once one of the values in the equation is a float the result will come out as float.</div>

<div><br></div><div>If you want to see the details on how this works you can find it here <a href="https://github.com/qgis/QGIS/blob/master/src/core/qgsexpression.cpp#L2093">https://github.com/qgis/QGIS/blob/master/src/core/qgsexpression.cpp#L2093</a></div>

<div><br></div><div>- Nathan </div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Aug 23, 2014 at 8:22 PM, ralfwessels <span dir="ltr"><<a href="mailto:gis@ralf-wessels.de" target="_blank">gis@ralf-wessels.de</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi<br>
intereseting, didn't know the left to right rule explained by Zoltan:<br>
<br>
Siki Zoltan wrote<br>
<div class="">> 100.0 * "HC01_VC04"  /  "HC01_VC03" will give you the right result.<br>
</div>> First the multiplication is evaluated (left to right rule),...<br>
<br>
Learning never stops!<br>
ralf<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://osgeo-org.1560.x6.nabble.com/Re-Field-calculator-QGIS2-4-division-error-tp5157715p5157980.html" target="_blank">http://osgeo-org.1560.x6.nabble.com/Re-Field-calculator-QGIS2-4-division-error-tp5157715p5157980.html</a><br>


<div class="HOEnZb"><div class="h5">Sent from the Quantum GIS - User mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
</div></div></blockquote></div><br></div>