Two fields "population" and "F06_popula" (both integers) were used in calculating a new field pct-diff. I asked that the new field be a decimal with a width of 10 and precision of 3. The result has no decimals. See the graphic. But the Layer Properties indicates that pct-diff is a real with 3 decimals. Why are the decimals not visible?
Thanks -
Tell me more
×
Geographic Information Systems Stack Exchange is a question and answer site for
cartographers, geographers and GIS professionals. It's 100% free, no registration required.
|
|
|||||
|
|
The formula ("F06-popula"-"population")/"population" is made up of all integer variables. Apparently the field calculator therefore did integer divide. When I multiplied the numerator by 1.0 ( one with a decimal) the result appeared as a floating point number. This was a surprise to me because the statistical languages I use (SAS,R,STATA) always does floating point arithmetic. So do the commercial GIS I use, TransCad. |
||||
|
|
|
I read a discussion http://hub.qgis.org/issues/5153 on the problem which no one seemed to agree on but a solution was found and far from obvious to me. In the field calculator under conversions in the functions list, use toreal like this: toreal(field1)/field2 it's more like unreal huh? |
|||||
|