<html><body><p><font size="2">Does &quot;</font><tt><font size="2">y finite not zero or infinite</font></tt><font size="2">&quot; mean &quot;</font><tt><font size="2">y finite not (zero or infinite)</font></tt><font size="2">&quot; or &quot;</font><tt><font size="2">y finite (not zero) or infinite</font></tt><font size="2">&quot;?  Would &quot;</font><tt><font size="2">y finite not zero and not infinite</font></tt><font size="2">&quot; be clearer and have the correct meaning?</font><br><font size="2"><br>- Ian McIntosh          IBM Canada Lab         Compiler Back End Support and Development<br></font><br><br><img width="16" height="16" src="cid:1__=8FBB08FDDFFCFCF78f9e8a93df938690918c8FB@" border="0" alt="Inactive hide details for Jim Thomas ---2018-04-09 06:07:36 PM---&gt; On Apr 7, 2018, at 2:48 PM, David Hough CFP &lt;pcfp@oakapple.n"><font size="2" color="#424282">Jim Thomas ---2018-04-09 06:07:36 PM---&gt; On Apr 7, 2018, at 2:48 PM, David Hough CFP &lt;pcfp@oakapple.net&gt; wrote: &gt;</font><br><br><font size="2" color="#5F5F5F">From:        </font><font size="2">Jim Thomas &lt;jaswthomas@sbcglobal.net&gt;</font><br><font size="2" color="#5F5F5F">To:        </font><font size="2">David Hough Cfp &lt;cfp-interest@oakapple.net&gt;</font><br><font size="2" color="#5F5F5F">Cc:        </font><font size="2">CFP &lt;cfp-interest@ucbtest.org&gt;</font><br><font size="2" color="#5F5F5F">Date:        </font><font size="2">2018-04-09 06:07 PM</font><br><font size="2" color="#5F5F5F">Subject:        </font><font size="2">Re: [Cfp-interest] 754 compatibility action item</font><br><font size="2" color="#5F5F5F">Sent by:        </font><font size="2">cfp-interest-bounces@oakapple.net</font><br><hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br><br><br><tt><font size="2"><br><br>&gt; On Apr 7, 2018, at 2:48 PM, David Hough CFP &lt;pcfp@oakapple.net&gt; wrote:<br>&gt; <br>&gt; <br>&gt;&gt; David: Look into the IEEE binding differences to see if they are real=20<br>&gt; issues (from Fred's email on 2018/02/18).<br>&gt; <br>&gt; <br>&gt; min/max and payload are more complex and I will try to look at those<br>&gt; separately.<br>&gt; <br>&gt; Here's my CONCLUSIONS on the simple cases. &nbsp; &nbsp;<br>&gt; Is this what you were looking for?:<br>&gt; <br>&gt; <br>&gt; 18661-1 versus 754<br>&gt; <br>&gt; 18661-1 has<br>&gt; &nbsp;remainder(x, +/-inf) returns x for x not infinite. [Allows x=NaN]<br>&gt; 754 has<br>&gt; &nbsp;remainder(x, inf) is x for finite x. (5.3.1)<br>&gt; &nbsp;remainder(x, inf) is exact for finite normal x. (6.1)<br>&gt; &nbsp;remainder(subnormal, inf) signals underflow. (6.1)<br>&gt; CONCLUSION:<br>&gt; 18661-1 needs to encompass these cases:<br>&gt; remainder(x, +/-inf) returns x for finite x, and if x is subnormal,<br>&gt; raises the &quot;underflow&quot; exception.<br><br>The 754 remainder operation signals underflow, but does not raise the underflow flag. This is not user-visible in standard C plus TS 18661-1. It is user detectable with alternate exception handling, as in TS 18661-5 or with implementation extensions.<br><br>Terminology might be confusing here: In 754 we say an operation signals an exception, where in C we say the operation raises a floating-point exception. In 754 we say an operation raises an exception flag, where in C we say the operation sets an exception flag.<br>&gt; <br>&gt; 18661 has<br>&gt; &nbsp;remainder(+/-0, y) returns +/-0 for y not zero. [Allows y=NaN]<br>&gt; 754 has<br>&gt; &nbsp;r = remainder(x, y) is defined for finite x and y ... (5.3.1)<br>&gt; &nbsp;If r = 0, its sign shall be that of x. (5.3.1)<br>&gt; CONCLUSION:<br>&gt; 18661-1 needs to encompass these cases:<br>&gt; &nbsp;remainder(+/-0, y) returns +/-0 for y finite not zero or infinite.<br><br>Hmm. Isn’t that what “y not zero” says? (NaN cases are covered globally.)<br>&gt; <br>&gt; 18661 has<br>&gt; &nbsp;roundeven() &quot;(that is, to the nearest value whose least significant<br>&gt; &nbsp;bit 0).&quot; &nbsp;It should be &quot;least significant integer bit&quot;.<br>&gt; 754 has<br>&gt; &nbsp;no such phrase in (5.3.1, 5.9)<br>&gt; CONCLUSION:<br>&gt; 18661-1 needs to say:<br>&gt; (that is, to the nearest value that is an even integer)<br>&gt; <br>&gt; If it's halfway between two integer values, one will be an even integer<br>&gt; and one value will be an odd integer. &nbsp;No need to mention bits.<br><br>agreed<br><br>&gt; <br>&gt; 18661 has<br>&gt; &nbsp;nextup(-HUGE_VAL) is not mentioned.<br>&gt; 754 has<br>&gt; &nbsp;nextup(-inf) is the finite negative number largest in magnitude. (5.3.1)<br>&gt; CONCLUSION:<br>&gt; 18661-1 says: <br>&gt; The nextup functions determine the next representable value, <br>&gt; in the type of the function, greater than x.<br>&gt; I think that handles the case nextup(-HUGE_VAL)<br><br>Also, in 7.12 (for all C implementations), -HUGE_VAL might not be -inf. See F.10.8.5 in TS 18661-1 for the 754 C implementation..<br>&gt; <br>&gt; 18661 has<br>&gt; &nbsp;nextdown(+HUGE_VAL) is not mentioned.<br>&gt; 754 has<br>&gt; &nbsp;nextdown(+inf) is -nextup(-inf) (5.3.1)<br>&gt; CONCLUSION:<br>&gt; Same as nextup.<br>&gt; <br>&gt; 18661 has<br>&gt; &nbsp;canonicalize(SNAN): appears to be missing a domain error in<br>&gt; &nbsp;the main body of the standard.<br>&gt; &nbsp;Also, for F.10.8.7, canonicalize(SNAN) raises 'invalid'.<br>&gt; 754 has<br>&gt; &nbsp;convertFormat: no mention of SNAN in 5.4.2, but is implied by 6.2<br>&gt; CONCLUSION:<br>&gt; In general, the main C standard specifies a domain error where 754<br>&gt; specifies invalid, right?<br>&gt; canonicalize is not a 754 function, but if it were, it would probably<br>&gt; raise invalid on snan.<br><br>C doesn’t explicitly specify domain errors for signaling NaN inputs. 7.12.1 says &quot;an implementation may define additional domain errors, provided that such errors are consistent with the mathematical definition of the function”, which allows such domain errors.<br><br>&gt; 18661<br>&gt; &nbsp;Would it be better if fesetexcept() returned the set of flags that<br>&gt; &nbsp;were successfully set?<br>&gt; 754<br>&gt; &nbsp;raiseFlags() returns void (5.7.4)<br>&gt; CONCLUSION:<br>&gt; I don't think I would use the function value - I'd presumably have <br>&gt; restricted my set to standard flags. &nbsp; &nbsp;There's no support for subexceptions<br>&gt; in C (and not much in 754).<br><br>I’m confused. fetestexcept is a C (not 18661) function. Why is it being compared to the 754 raiseFlags operation?<br><br>&gt; <br>&gt; 18661<br>&gt; &nbsp;fetestexceptflag() returns &quot;OR&quot; of two items; I think it should be<br>&gt; &nbsp;&quot;AND&quot;. &nbsp;Also the order of the two arguments is switched from 754.<br>&gt; 754<br>&gt; &nbsp;returns a boolean (5.7.4)<br>&gt; CONCLUSION:<br>&gt; Definitely AND.<br><br>It says &quot;[3] The fetestexceptflag function returns the value of the bitwise OR of the floating-point exception macros included in excepts corresponding to the floating-point exceptions set in *flagp.” There’s effectively an AND occurring, but the result is an OR of macro values.<br><br>&gt; As for argument order, if there's nothing in C to be compatible with,<br>&gt; then it might as well be compatible with 754.<br><br>The argument order is the same as for the C functions getexceptflag and setexceptflag.<br><br>- Jim Thomas<br><br>&gt; <br>&gt; Not sure about min, max, minmag, maxmag, since I am looking at 18661-1<br>&gt; (2014) and there have been updates to it.<br>&gt; Not sure about payload related functions as 754 keeps changing.<br>&gt; CONCLUSION: I'll try to look at these separately.<br>&gt; <br><br><br>_______________________________________________<br>Cfp-interest mailing list<br>Cfp-interest@oakapple.net<br></font></tt><tt><font size="2"><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__mailman.oakapple.net_mailman_listinfo_cfp-2Dinterest&d=DwIGaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=md70fwFQha_5ElmLKrMoig&m=-U0ncxdRHo_QRYbeh1aPec3aBndfBEneuHv5vbZiZxM&s=uh9LZYlS-xmz5ejuBCIH-f3IMOnHvvs2SXkGSUYGd64&e=">https://urldefense.proofpoint.com/v2/url?u=http-3A__mailman.oakapple.net_mailman_listinfo_cfp-2Dinterest&amp;d=DwIGaQ&amp;c=jf_iaSHvJObTbx-siA1ZOg&amp;r=md70fwFQha_5ElmLKrMoig&amp;m=-U0ncxdRHo_QRYbeh1aPec3aBndfBEneuHv5vbZiZxM&amp;s=uh9LZYlS-xmz5ejuBCIH-f3IMOnHvvs2SXkGSUYGd64&amp;e=</a></font></tt><tt><font size="2"><br><br></font></tt><br><br><BR>
</body></html>