[PATCH] D15120: Add support for __float128 type to be used by targets that support it

John McCall via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 26 17:02:51 PST 2016

rjmccall added a comment.

In http://reviews.llvm.org/D15120#336776, @hubert.reinterpretcast wrote:

> In http://reviews.llvm.org/D15120#336430, @rjmccall wrote:
> > As I understand it, PPC's long-double (~103 bits of precision) is still strictly less precise than float128_t (113 bits of precision), so it ought to be have lower rank.  Is there actually a supported platform where this is not true?  If not, we should just add this as another type with higher rank.
> PPC's long-double has variable precision. It is not strictly less precise than float128_t.

Ah, right.  I was thinking of it as if the lower double were pegged to 1/2 an ulp of the higher double, but it isn't; it can be variably lower.

Here's the thing, though: I don't think there's a reasonable language solution here besides saying that float128_t has higher rank.  You can't make the types incompatible, because it's clearly reasonable to simply convert one to the other.  What you're trying to say is that they don't have a common type, but it's a novel concept in C/C++ to have two arithmetic types that don't have a common type and therefore cannot be added / compared / ternary'd together.  In contrast, it is not a novel concept to have a type that implicitly promotes to another type but potentially loses precision, because all the integer types will happily convert to float/double.

This patch will be much simpler, and you will get a better language design, if you simply make float128_t a new FP type with a higher rank than long double.



More information about the cfe-commits mailing list