C++ Logo

std-proposals

Advanced search

Re: default floating point

From: Thiago Macieira <thiago_at_[hidden]>
Date: Fri, 15 Jan 2021 07:34:54 -0800
On Friday, 15 January 2021 02:15:11 PST Giuseppe D'Angelo via Std-Proposals
wrote:
> Qt has supported this for decades with a custom `qreal` type which is
> simply a typedef; at build time you can choose it to be float or double.
> (It used to default on double everywhere except on older ARM CPUs, where
> it was float. These days it's double everywhere.)

And the reason it's double everywhere now is because having a type differ that
meaningfully caused a lot of problems. Like long changing sizes according to
architecture, it's difficult to use it for serialisation and expect proper
cross-platform behaviour. This also caused applications to exhibit slight mis-
behaviour because no one tested on those CPUs/FPUs.

Finally, the days of single-precision being slower are gone with the Cortex-
A8, from the late 2000s.

Is this still a problem? Is it big enough to deserve a language or standard
library change? And how does it relate to the extended floating point type
support paper?

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DPG Cloud Engineering

Received on 2021-01-15 09:35:00