Bug report #11182
Expression editor in Layer Properties does not support division of integer data
|Affected QGIS version:||2.4.0||Regression?:||No|
|Operating System:||Linux||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||worksforme|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||19495|
Affected function: under Layer Properties --> Style --> Graduated --> Expression
Issue: writing an expression that divides values in two separate columns (type: int; length: 10) of an ESRI SHP file results in incorrect value (0). Addition, subtraction, and multiplication all work as expected and produce sensible results.
Expected behaviour: when dividing two integer values, the result should be promoted to a real value.
The Expression editor is non-functional in its present state.
#3 Updated by Jürgen Fischer about 5 years ago
- Resolution set to worksforme
- Status changed from Open to Closed
d d wrote:
It looks like this was discussed previously, but never resolved: #5153
That's the intended behaviour. Division of integers produce integers. You can convert either argument using
to real(int) to produce a floating point result.