<div dir="ltr"><div>Hi Andrea,</div><div><br></div><div>Thank you very much for pointing me in the right direction! Now I understand why, for instance, 0.25 was converted to 0.25 both in Float32 and Float64. That was really strange for me.<br></div><div><br></div><div>No doubt that all come from the conversion of floating point numbers.</div><div><br></div><div>However, this can be really tricky and lead to wrong results in a processing like I was talking about, with reclassifications or so.</div><div><br></div><div>Is there any workaround that can be used by QGIS / GDAL? Maybe an option to the user specify the number of decimal places? If this is not possible, maybe making Float64 as default could be safer?</div><div><br></div><div>Even, what do you think?<br></div><div><br></div><div>Thank you very much!</div><div><br></div><div>Best regards,</div><div>Pedro</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Andrea Giudiceandrea <<a href="mailto:andreaerdna@libero.it">andreaerdna@libero.it</a>> escreveu no dia quarta, 28/10/2020 à(s) 16:57:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Pedro,<br>
"decimal" to float (IEEE754) conversion is unlikely an exact conversion:<br>
<br>
The most accurate representation of 0.22 in<br>
float single precision (32 bit) is  0.2199999988079071044921875<br>
float double precision (64 bit) is 0.220000000000000001110223024625<br>
<br>
So probably the different behavior is due to the way GDAL or QGIS chose to<br>
represent and handle these values using a finite number of decimal places<br>
rounding/truncating at (so it seems) 16 digits:<br>
<br>
0.2199999988079071044921875 becomes 0.2199999988079071 and<br>
0.220000000000000001110223024625 becomes 0.22<br>
<br>
Regards.<br>
<br>
Andrea<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html" rel="noreferrer" target="_blank">http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html</a><br>
_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a></blockquote></div>