[Cfp-interest 2242] Usual arithmetic conversions for long double and _FLoat64
David Olsen
dolsen at nvidia.com
Sun Oct 17 21:20:27 PDT 2021
On an implementation where double, long double, and _Float64 all have the same format of IEEE 64-bit, what is the result type of an operation with operands of long double and _Float64? My reading of the usual arithmetic conversions in section X.4.2 if N2601<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2601.pdf> is that the result type is _Float64, because interchange floating types are preferred over standard floating types when the two types have the same sets of values. Is my interpretation correct?
I am working on modifying the C++ floating-point proposal P1467 so that the usual arithmetic conversion rules match those in N2601 and C23, as was requested in the joint SG22/CFP meeting. I am having trouble with this one situation.
On implementations where long double is bigger than double, long double + _Float64 -> long double. I think the usual arithmetic conversion rules should be consistent so that long double + _Float64 -> long double all the time, even when long double has the same set of values as _Float64. This will help users when porting code between implementations that have different representations for long double. Is it possible to tweak the usual arithmetic conversion rules in C23 to make this change?
(I believe that long double + _Float64 is the only combination of standard and interchange floating types where the result type can change between conforming implementations. I guess long double + _Float128 -> long double if long double is bigger than _Float128, but I don't think any such implementations exist.)
(I have no problem with double + _Float64 -> _Float64. That makes sense, and I have changed the C++ proposal to do that. It is only long double + _Float64 that I have an issue with.)
- David Olsen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20211018/5ee5528b/attachment.htm>
More information about the Cfp-interest
mailing list