Bug report #11487
Dividing integer with integer gives wrong result (if operation is supposed to return a decimal)
Status: | Closed | ||
---|---|---|---|
Priority: | Severe/Regression | ||
Assignee: | - | ||
Category: | Expressions | ||
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 |
Description
Hi,
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.
Related issues
History
#1
Updated by Giovanni Manghi almost 10 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 (
7) - Operating System deleted (
windows) - 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?
#2
Updated by Jürgen Fischer almost 10 years ago
- Status changed from Feedback to Closed
- Resolution set to duplicate
duplicate of #5153