[QGIS-Developer] Wrong results converting vectors to Float32 rasters

Andrea Giudiceandrea andreaerdna at libero.it
Wed Oct 28 09:57:39 PDT 2020


Hi Pedro,
"decimal" to float (IEEE754) conversion is unlikely an exact conversion:

The most accurate representation of 0.22 in
float single precision (32 bit) is  0.2199999988079071044921875
float double precision (64 bit) is 0.220000000000000001110223024625

So probably the different behavior is due to the way GDAL or QGIS chose to
represent and handle these values using a finite number of decimal places
rounding/truncating at (so it seems) 16 digits:

0.2199999988079071044921875 becomes 0.2199999988079071 and
0.220000000000000001110223024625 becomes 0.22

Regards.

Andrea



--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html


More information about the QGIS-Developer mailing list