For some time we have wanted to unify the behavior of qreal on desktop and 
embedded. Currently, qreal is defined to be double on desktop and to a float on 
embedded. 

The reasons for unifying are:

 - Using "double" is pure waste for a lot of use cases. QRectF, QPointF, 
QPainter, QPolygonF, OpenGL, QMouseEvent, QTouchEvent, to name a few. None of 
these  require the precision offered by double precision floating point. 

 - Predictable behavior on across desktop and device. In the past we have had a 
few cases where things fell apart when run on embedded because the reduced 
precision. These were fixed, but they would have been immediately caught during 
development if they were the same.

 - For specific use cases were higher precision floats are required, double can 
still be used. Both inside and outside the Qt libraries. 

Our initial idea was to change "qreal" to "double" to avoid any potential 
regression but the impact on size combined with the fact that the added 
precision is almost never needed changed our minds 
(https://bugreports.qt-project.org/browse/QTBUG-23758)

The only questionable use case is geolocation. We know for a fact that floats 
have limitations in this area and both Qt3D and QtLocation make use of 
QVector[2|3|4]D and QMatrix4x4 which will now be a float. However, this is no 
worse (for device) than it already is, so any use case that fails and needs 
work will now be found early in the development cycle as opposed to during 
device testing.

Unless there are any objections that I have not yet covered, I will go ahead 
with this change.

cheers,
Gunnar
_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to