[Development] Changing qreal to a float

Jedrzej Nowacki jedrzej.nowacki at nokia.com
Wed Feb 15 09:27:33 CET 2012


On Wednesday 15. February 2012 08.38.44 ext gunnar.sletta at nokia.com wrote:
> 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 at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development

Great! I'll be abe to remove workarounds for this issue from QMetaType :-)

Cheers,
 Jędrek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120215/1382b48c/attachment.html>


More information about the Development mailing list