C++ Logo

liaison

Advanced search

Re: [wg14/wg21 liaison] C and C++ Compatibility SG meeting summary for Oct 06, 2021

From: Joseph Myers <joseph_at_[hidden]>
Date: Thu, 7 Oct 2021 16:38:32 +0000
On Thu, 7 Oct 2021, Aaron Ballman via Liaison wrote:

> The meeting minutes from the Oct 2021 special session on
> floating-point types can be found at:
> https://wiki.edg.com/bin/view/Wg21telecons2021/Teleconference2021-10-06.
> The WG14 minutes will be posted to the document log in the near
> future.

I note that the WG14 minutes
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2835.pdf say "C doesn't
allow BFP <-> DFP implicit conversions.".

That may be misleading. C *does* allow such implicit conversions in the
conversion-as-if-by-assignment case; code such as

float f (_Decimal128 x) { return x; }

is valid just as it would be for *any* two arithmetic types (the relevant
option in 6.5.16.1 Simple assignment is "the left operand has atomic,
qualified, or unqualified arithmetic type, and the right has arithmetic
type"; initialization, argument passing and return then refer to
conversion as if by assignment).

What's not allowed is mixing decimal and standard / binary / complex /
imaginary types in contexts subject to the usual arithmetic conversions.
"If one operand has decimal floating type, the other operand shall not
have standard floating, complex, or imaginary type." (6.3.1.8), with
"binary floating type" inserted in N2601. (And N2601 also makes it
undefined if neither real floating type's values are a subset of those of
the other type.)

-- 
Joseph S. Myers
joseph_at_[hidden]

Received on 2021-10-07 11:38:42