C++ Logo


Advanced search

Re: Reserve good keywords for floating point types

From: Lyberta <lyberta_at_[hidden]>
Date: Tue, 15 Oct 2019 15:04:00 +0000
Thiago Macieira via Std-Proposals:
> But for local data manipulation, that's not necessary. Take this simple
> percentage calculation:
> cout << "Total complete: " << (count * 100. / total) << "%\n";
> There's no need to specify that this needs to be calculated using 53 bits of
> decimal precision instead of 52. We just need a good enough type that is fast
> on the host machine.

This would actually depend on the type of "count" and should be inside a
template but end type will most likely have way more semantics.

> It does if "float is binary" is the convention.
> - std::floatN_iec559_t is binaryN
> - std::decimalN_iec559_t is decimalN

I would like that convention if going for types with short names. With
those long names it looks strange.

I have found that "float_binaryN" identifiers are unused so I'm working
on new draft that proposes those as a compromise.

>> Again, flexible types are a relic of the past and only useful in
>> extremely rare circumstances. Fixed layout is what's needed in 99% of cases.
> I disagree. Flexible types are useful in a lot more cases and fixing them to
> specific layouts is needed only when interoperating with the world outside the
> process.

There is strange logic. "Specific layouts are needed only when
interoperating with the world". But, most software interoperates with world.

I can think of only 2 cases when layout doesn't matter:

* Hello world
* Homework assignment

Received on 2019-10-15 10:06:53