<html><body>
<p><font size="2" face="sans-serif">Would it work to just replace</font><br>
<font size="2" face="sans-serif">        </font><font size="3" face="Courier New"><b>isgreaterequal(fabs(x), fabs(y))</b></font><br>
<font size="2" face="sans-serif">with</font><br>
<font size="2" face="sans-serif">        </font><font size="3" face="Courier New"><b>(fabs(x) >= fabs(y))</b></font><br>
<font size="2" face="sans-serif">at least when </font><font size="3" face="Courier New"><b>FP_SNANS_ALWAYS_SIGNAL</b></font><font size="2" face="sans-serif"> is defined, so the >= triggers on the signaling NaN?</font><br>
<br>
<font size="2" face="sans-serif">- Ian McIntosh IBM Canada Lab Compiler Back End Support and Development<br>
</font><br>
<br>
<img width="16" height="16" src="cid:1__=0ABBF00ADFEC7FB88f9e8a93df938@ca.ibm.com" border="0" alt="Inactive hide details for Jim Thomas ---10/16/2012 12:03:50 AM---The sample implementations of fmax and round have similar prob"><font size="2" color="#424282" face="sans-serif">Jim Thomas ---10/16/2012 12:03:50 AM---The sample implementations of fmax and round have similar problems. -Jim</font><br>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBF00ADFEC7FB88f9e8a93df938@ca.ibm.com" border="0" alt=""><br>
<ul style="padding-left: 4pt"><font size="1" color="#5F5F5F" face="sans-serif">From:</font></ul>
</td><td width="100%"><img width="1" height="1" src="cid:2__=0ABBF00ADFEC7FB88f9e8a93df938@ca.ibm.com" border="0" alt=""><br>
<font size="1" face="sans-serif">Jim Thomas <jaswthomas@sbcglobal.net></font></td></tr>
<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBF00ADFEC7FB88f9e8a93df938@ca.ibm.com" border="0" alt=""><br>
<ul style="padding-left: 4pt"><font size="1" color="#5F5F5F" face="sans-serif">To:</font></ul>
</td><td width="100%"><img width="1" height="1" src="cid:2__=0ABBF00ADFEC7FB88f9e8a93df938@ca.ibm.com" border="0" alt=""><br>
<font size="1" face="sans-serif">CFP <cfp-interest@ucbtest.org></font></td></tr>
<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBF00ADFEC7FB88f9e8a93df938@ca.ibm.com" border="0" alt=""><br>
<ul style="padding-left: 4pt"><font size="1" color="#5F5F5F" face="sans-serif">Date:</font></ul>
</td><td width="100%"><img width="1" height="1" src="cid:2__=0ABBF00ADFEC7FB88f9e8a93df938@ca.ibm.com" border="0" alt=""><br>
<font size="1" face="sans-serif">10/16/2012 12:03 AM</font></td></tr>
<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBF00ADFEC7FB88f9e8a93df938@ca.ibm.com" border="0" alt=""><br>
<ul style="padding-left: 4pt"><font size="1" color="#5F5F5F" face="sans-serif">Subject:</font></ul>
</td><td width="100%"><img width="1" height="1" src="cid:2__=0ABBF00ADFEC7FB88f9e8a93df938@ca.ibm.com" border="0" alt=""><br>
<font size="1" face="sans-serif">Re: [Cfp-interest] problem with fmaxmag code</font></td></tr>
<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBF00ADFEC7FB88f9e8a93df938@ca.ibm.com" border="0" alt=""><br>
<ul style="padding-left: 4pt"><font size="1" color="#5F5F5F" face="sans-serif">Sent by:</font></ul>
</td><td width="100%"><img width="1" height="1" src="cid:2__=0ABBF00ADFEC7FB88f9e8a93df938@ca.ibm.com" border="0" alt=""><br>
<font size="1" face="sans-serif">cfp-interest-bounces@oakapple.net</font></td></tr>
</table>
<hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br>
<br>
<br>
<font size="3" face="serif">The sample implementations of </font><font size="3" face="serif"><b>fmax</b></font><font size="3" face="serif"> and </font><font size="3" face="serif"><b>round</b></font><font size="3" face="serif"> have similar problems.</font><br>
<br>
<font size="3" face="serif">-Jim</font><br>
<br>
<font size="3" face="serif">On Oct 15, 2012, at 2:38 PM, Jim Thomas wrote:</font><br>
<ul style="padding-left: 36pt"><br>
<font size="3" face="serif">Our Part 1 draft has</font>
<p><font size="3" face="serif">------------------------------------------------</font>
<p><font size="3" face="serif">[3] The body of the </font><font size="3" face="Courier New"><b>fmaxmag</b></font><font size="3" face="serif"> function might be</font><a href="x-msg://150/#_ftn1"><font size="1" color="#0000FF" face="Arial"><u>[1]</u></font></a><font size="3" face="serif">
</font>
<ul style="padding-left: 18pt"><br>
<font size="3" face="Courier New"><b>{ return (isgreaterequal(fabs(x), fabs(y)) || isnan(y)) ? x : y; }</b></font></ul>
<br>
<font size="3" face="serif"><br>
</font><hr width="100%" size="2" align="left">
<p><a href="x-msg://150/#_ftnref1"><font size="1" color="#0000FF" face="Arial"><u>[1]</u></font></a><font size="3" face="serif"> This implementation does not handle signaling NaNs as required of implementations that define </font><font size="3" face="Courier New"><b>FP_SNANS_ALWAYS_SIGNAL</b></font><font size="3" face="serif">.</font>
<p><font size="3" face="serif">------------------------------------------------</font>
<p><font size="3" face="serif"><b>isgreaterequal</b></font><font size="3" face="serif"> might or might not raise the "invalid" floating-point exception if the implementation does not define </font><font size="3" face="Courier New"><b>FP_SNANS_ALWAYS_SIGNAL</b></font><font size="3" face="serif">. Suppose it does. Suppose also that same-format conversions are copy operations. Then if </font><font size="3" face="serif"><b>x</b></font><font size="3" face="serif"> is a signaling NaN, the code would raise "invalid" but return a signaling NaN, violating F.2.1[4]. A fix would be to change the code to</font>
<ul style="padding-left: 18pt"><br>
<font size="3" face="Courier New"><b>{ return canonicalize((isgreaterequal(fabs(x), fabs(y)) || isnan(y)) ? x : y); }</b></font></ul>
<br>
<font size="3" face="serif">Then we could remove the footnote. The change would also serve to produce a canonical result.</font><br>
<br>
<font size="3" face="serif">Any better ideas?</font><br>
<br>
<font size="3" face="serif">-Jim</font></ul>
<tt><font size="2">_______________________________________________<br>
Cfp-interest mailing list<br>
Cfp-interest@oakapple.net<br>
</font></tt><tt><font size="2"><a href="http://mailman.oakapple.net/mailman/listinfo/cfp-interest">http://mailman.oakapple.net/mailman/listinfo/cfp-interest</a></font></tt><tt><font size="2"><br>
</font></tt><br>
<br>
</body></html>