C++ Logo

std-proposals

Advanced search

Re: default floating point

From: Giuseppe D'Angelo <giuseppe.dangelo_at_[hidden]>
Date: Fri, 15 Jan 2021 11:15:11 +0100
Hi,

Il 15/01/21 03:22, Vishal Oza via Std-Proposals ha scritto:
> I was thinking of adding a default floating point type like int to the
> integer type rather than assume that double is the default. This might
> be better on older hardware where using a double might have a
> performance penalty. The keyword would either be flt or floating_point.
> I prefer flt for less typing but I can understand that it could break
> existing code. Can anyone arue why this is a bad idea?

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.)

Do you need a _language_ solution?

Thanks,
-- 
Giuseppe D'Angelo | giuseppe.dangelo_at_[hidden] | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

Received on 2021-01-15 04:15:25