[QGIS-Developer] round function not working

Raymond Nijssen r.nijssen at terglobo.nl
Sun Sep 2 03:47:20 PDT 2018


Just discovered similar unexpected rounding behavior, but a bit 
different I think:


My expression is this one, to show lengths of tracks on my map, in km:

"etappe" || '\n (' || 
round((length(transform($geometry,'epsg:4326','epsg:31466'))/1000), 1) 
|| ' km)'


The rounding does actually work fine, but it seems the conversion from 
my rounded value to a string is the problem.

Here some examples (qgis 3.3):

round(0.99, 1) --> 1
round(1.00, 1) --> 1
round(1.01, 1) --> 1
round(1.02, 1) --> 1
round(1.03, 1) --> 1
round(1.04, 1) --> 1
round(1.05, 1) --> 1.1000000000000001
round(1.06, 1) --> 1.1000000000000001
round(1.07, 1) --> 1.1000000000000001
round(1.08, 1) --> 1.1000000000000001
round(1.09, 1) --> 1.1000000000000001
round(1.10, 1) --> 1.1000000000000001
round(1.11, 1) --> 1.1000000000000001
round(1.12, 1) --> 1.1000000000000001
round(1.13, 1) --> 1.1000000000000001
round(1.14, 1) --> 1.1000000000000001
round(1.15, 1) --> 1.2
round(1.16, 1) --> 1.2
round(1.17, 1) --> 1.2
round(1.18, 1) --> 1.2
round(1.19, 1) --> 1.2
round(1.20, 1) --> 1.2
round(1.19, 1) --> 1.2


The same works fine in 2.18.16.

Should I file a bug?

Kind regards,
Raymond



On 22-12-17 13:13, matteo wrote:
> Hi Andreas,
> 
> thanks for the testing. I'm suspecting that something is weird with my
> data....
> 
> thanks and sorry for the noise!
> 
> Cheers
> 
> Matteo
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the QGIS-Developer mailing list