<div dir="ltr">I think this means that the same integer constant expression can now evaluate to different integers depending on the rounding mode. Thus<div><br></div><div>int a[1 + (int)0.99999999999999999999999999999999999)]; may not be type compatible with itself, if it occurs in different rounding mode contexts.</div><div><br></div><div>I'm not enough of a language lawyer and C compiler expert to determine whether this can be made to work. But I suspect the reason for the original rule was that somebody thought it couldn't.</div><div><br></div><div>Hans</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 31, 2023 at 7:40 AM Jim Thomas <<a href="mailto:jaswthomas@sbcglobal.net">jaswthomas@sbcglobal.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><br><div><br><blockquote type="cite"><div>On Jan 30, 2023, at 5:51 PM, Vincent Lefevre <<a href="mailto:vincent@vinc17.net" target="_blank">vincent@vinc17.net</a>> wrote:</div><br><div><div>On 2023-01-30 15:19:52 -0800, Jim Thomas wrote:<br><blockquote type="cite">6.4.4.2 #8 says:<br><br>All floating constants of the same source form 83) shall convert to the same internal format with the same value.<br><br>With the FENV_ROUND and FENV_DEC_ROUND pragmas this is no longer true. For example, 7.6.2 #4 for FENV_ROUND says "Floating constants (6.4.4.2) of a standard floating type that occur in the scope of a constant rounding mode shall be interpreted according to that mode."<br><br>This was pointed out in a recent email which I was unable to find. Thanks to the sender.<br></blockquote><br>I posted the remark about 6.4.4.2 #8 in Cfp-interest 2634:<br>  <a href="http://mailman.oakapple.net/pipermail/cfp-interest/2023-January/002648.html" target="_blank">http://mailman.oakapple.net/pipermail/cfp-interest/2023-January/002648.html</a><br><br>But I hadn't noticed the issue with FENV_ROUND.<br><br><blockquote type="cite">A fix would be to replace the sentence with something like:<br><br>All floating constants of the same source form shall convert to the same internal format. All floating constants of the same source form that are subject to the same translation-time rounding direction (either the default or a rounding direction set by an FENV_ROUND or FENV_DEC_ROUND pragma) shall convert to the same internal format with the same value.<br><br>or<br><br>All floating constants of the same source form shall convert to the same internal format and, provided they are subject to the same translation-time rounding direction (either the default or a rounding direction set by an FENV_ROUND or FENV_DEC_ROUND pragma), to the same value.<br></blockquote><br>Both are unclear. What if it is set to FE_DYNAMIC?<br></div></div></blockquote><div><br></div><div>Maybe</div><div><br></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>All floating constants of the same source form shall convert to the same internal format and, provided they are subject to the same translation-time rounding direction (either the default or a constant rounding mode other that FE_DYNAMIC set by an FENV_ROUND or FENV_DEC_ROUND pragma), to the same value.</div><div><br></div></blockquote>But that would suggest that same-form floating constants could have different values under FE_DYNAMIC. Setting to FE_DYNAMIC should not affect the translation time conversion of floating constants in that they would still get default translation-time rounding.<div><br><blockquote type="cite"><br>BTW, is there a way to restore the static rounding mode when<br>outside external declarations? This would be important if one<br>wants to use this pragma in a header file.<br></blockquote><div><br></div>It can be “restored" to FE_DYNAMIC which serves as a “default”.</div><div><br></div><div>- Jim Thomas<br><blockquote type="cite"><br>-- <br>Vincent Lefèvre <<a href="mailto:vincent@vinc17.net" target="_blank">vincent@vinc17.net</a>> - Web: <<a href="https://www.vinc17.net/" target="_blank">https://www.vinc17.net/</a>><br>100% accessible validated (X)HTML - Blog: <<a href="https://www.vinc17.net/blog/" target="_blank">https://www.vinc17.net/blog/</a>><br>Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)<br>_______________________________________________<br>Cfp-interest mailing list<br><a href="mailto:Cfp-interest@oakapple.net" target="_blank">Cfp-interest@oakapple.net</a><br><a href="http://mailman.oakapple.net/mailman/listinfo/cfp-interest" target="_blank">http://mailman.oakapple.net/mailman/listinfo/cfp-interest</a><br></blockquote><div><br></div></div><br></div>_______________________________________________<br>
Cfp-interest mailing list<br>
<a href="mailto:Cfp-interest@oakapple.net" target="_blank">Cfp-interest@oakapple.net</a><br>
<a href="http://mailman.oakapple.net/mailman/listinfo/cfp-interest" rel="noreferrer" target="_blank">http://mailman.oakapple.net/mailman/listinfo/cfp-interest</a><br>
</blockquote></div>