Feature request #11338
field calculator: if you choose 'double' as fieldtype, the precision is NOT set to >0
|Pull Request or Patch supplied:||No||Resolution:|
|Easy fix?:||No||Copied to github as #:||19632|
After a question on IRC of somebody who ended up with area's of 0
Load the shp from test.zip (epsg:28992)
Make layer editable
Open Field Calculator
Tick 'create a new field' and fieldname 'area' and fieldtype double (but do not touch the precision which in my case is 0 then)
Now create the column with value $area
then the area looks ok
but after saving all numbers are/look integers....
REMARK: changed from bug to feature request.
After some testing it appeared that the precision in the dialog was on 0 (zero)
so the actual were doubles, but without precision (25.1233 became 25).
So feature request: IF the user chooses 'double' as fieldtype and the precision = zero,
then either let it know (because a double with zero precision is not a double) and warn the user,
OR set the precision on 5 or so
also it's not fully clear if the 'precision' includes the output fieldwidth or not,
from IRC: "i set the precision to 10, saves 8, i set to 11 saves with 9 precision"
#3 Updated by Richard Duivenvoorde over 5 years ago
@mkuhn: Change the default precision for double to 5 instead of 0
So the Output field width should change to sensible defaults when you change the type.
as you see in #9142 also it is a caveat when you do not look at the precision...
Now if you change from double to int, it sets the precision to 0, but the other way around it does NOT set it back or to an other sensible value for double.
Same with text, I would think that maybe 30 is more sensible width then 10?