Otherwise, if either operand is of floating-point type, the following rules are applied:
If both operands have the same type, no further conversion is needed.
No conversion is needed, but is it permitted? Is an implementation allowed to define the result of float + float as double?
That does not seem like it is the intent, at least for standard floating-point types. What about extended floating-point types?
Supposing that half is a narrower than float floating-point type such as an 8 or 16 bit float, half + half resulting in float may be quite reasonable on some architectures.
Suggested resolution:
Assuming that no such conversions should be permitted for any floating-point types:
- If both operands have the same type, no further conversion is needed.
+ If both operands have the same type, no further conversion is applied.
Full name of submitter: Lauri Vasama
Reference (section label): [expr.arith.conv]
Issue description:
No conversion is needed, but is it permitted? Is an implementation allowed to define the result of
float + float
asdouble
? That does not seem like it is the intent, at least for standard floating-point types. What about extended floating-point types? Supposing thathalf
is a narrower thanfloat
floating-point type such as an 8 or 16 bit float,half + half
resulting infloat
may be quite reasonable on some architectures.Suggested resolution:
Assuming that no such conversions should be permitted for any floating-point types: