<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">On an implementation where <span style="font-family:"Courier New"">
double</span>, <span style="font-family:"Courier New"">long double</span>, and <span style="font-family:"Courier New"">
_Float64</span> all have the same format of IEEE 64-bit, what is the result type of an operation with operands of
<span style="font-family:"Courier New"">long double</span> and <span style="font-family:"Courier New"">
_Float64</span>? My reading of the usual arithmetic conversions in section X.4.2 if
<a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2601.pdf">N2601</a> is that the result type is
<span style="font-family:"Courier New"">_Float64</span>, because interchange floating types are preferred over standard floating types when the two types have the same sets of values. Is my interpretation correct?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">On implementations where <span style="font-family:"Courier New"">
long double</span> is bigger than <span style="font-family:"Courier New"">double</span>,
<span style="font-family:"Courier New"">long double + _Float64 -> long double</span>. I think the usual arithmetic conversion rules should be consistent so that
<span style="font-family:"Courier New"">long double + _Float64 -> long double</span> all the time, even when
<span style="font-family:"Courier New"">long double</span> has the same set of values as
<span style="font-family:"Courier New"">_Float64</span>. This will help users when porting code between implementations that have different representations for
<span style="font-family:"Courier New"">long double</span>. Is it possible to tweak the usual arithmetic conversion rules in C23 to make this change?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">(I believe that <span style="font-family:"Courier New"">long double + _Float64</span> is the only combination of standard and interchange floating types where the result type can change between conforming implementations. I guess
<span style="font-family:"Courier New"">long double + _Float128 -> long double</span> if
<span style="font-family:"Courier New"">long double</span> is bigger than <span style="font-family:"Courier New"">
_Float128</span>, but I don’t think any such implementations exist.)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">(I have no problem with <span style="font-family:"Courier New"">
double + _Float64 -> _Float64</span>. That makes sense, and I have changed the C++ proposal to do that. It is only
<span style="font-family:"Courier New"">long double + _Float64</span> that I have an issue with.)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> - David Olsen<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>