Bug report #11487
Dividing integer with integer gives wrong result (if operation is supposed to return a decimal)
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||duplicate|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||19757|
When I try to calcul a proportion based on two int field in a float column I obtain nothing. I should obtain something like 82,3 or -12,4 in result.
If I only make one operation it working, for example one int field divide by 2.888 I obtain the good result, but If I make divide operation between two int field the result is 0.000.
#1 Updated by Giovanni Manghi almost 6 years ago
- Subject changed from Error in result of operation of field calculator from int to float field to Dividing integer with integer gives wrong result (if operation is supposed to return a decimal)
- Status changed from Open to Feedback
- Category changed from Attribute table to Expressions
- Affected QGIS version changed from 2.4.0 to master
- OS version deleted (
- Operating System deleted (
- Priority changed from Normal to Severe/Regression
To replicate it is not necessary to use existing attributes:
10/3 gives 3 (!!!)
10/3.0 gives 3.333333
10.0/3 gives 3.333333
toreal(10)/3 gives 3.333333
is this really the intended behavior?