1

I wish to use rounded values as labels using QGIS 3.4.4. My field is type "double" and the the data source is a Spatialite table. I notice two odd behaviors linked to this problem. First, the attribute values have false precision. For example, in the source file, a value is 16.300000, but it appears as 16.300000000000001 in QGIS. Second, when I attempt to use the round function under labels, the value can either be truncated to zero decimal places using round or the precision can't be reduced at all, no matter what precision I supply to round. How can I resolve this problem?

4
  • Which QGIS 3 version are you using? Could you please specify the exact version number from Help → About QGIS?
    – ahmadhanb
    Aug 5, 2020 at 2:45
  • QGIS version 3.4.4
    – eric s
    Aug 5, 2020 at 2:47
  • 2
    I remember there was a bug in QGIS 3.4.2 regarding rounding negative number and it was solved with QGIS 3.4.4-3, as you can see in the answer to the question: Using round function in QGIS expression?. Maybe your case was reported also as a bug, I am not sure. To make everything clear, try to update to the latest LTR 3.10.8, and see if update solve the problem.
    – ahmadhanb
    Aug 5, 2020 at 2:55
  • 1
    The first issue is not an issue. You can test with exploringbinary.com/floating-point-converter that it is not possible to save decimal value 16.3 accurately into double. When converted back it becomes 16.300000000000000710542735760100185871124267578125.
    – user30184
    Aug 5, 2020 at 7:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.