1

This question already has an answer here:

In QGIS 3.4.4, using the Field Calculator, the expression

round(-2.040,1)

returns

-1.9

where I expected it to return

-2

Converting the field to real round(to_real(-2.040),1) did not change anything.

In QGIS 2.18.19 and got the expected result.

Is the syntax changed in 3.x or is this a (known) bug? Or am I expecting the wrong output?

QGIS 3.4.4

QGIS 2.18.19

marked as duplicate by ahmadhanb qgis Feb 4 at 11:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Interesting. The problem is reproducible, though only valid for negative values. Always the last number is rounded wrongly. Positive values are rounded correctly. – Erik Feb 4 at 11:00
3

I believe this bug has been reported and fixed for the next update:

https://issues.qgis.org/issues/20861

  • 1
    Thanks sir, this is an answer I was looking for. – nielsgerrits Feb 4 at 11:10
  • 2
    @nielsgerrits and Joseph The issue of rounding negative values was fixed in the latest stable release of QGIS 3.4.4-3. Now rounding negative numbers produces correct results. Please refer to the duplicate question link. – ahmadhanb Feb 15 at 6:22
  • @Joseph You are welcome :) – ahmadhanb Feb 15 at 10:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.