<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Comments inline.</div><br><div><div>On Jun 10, 2013, at 8:03 AM, Duncan Sands <<a href="mailto:baldrick@free.fr">baldrick@free.fr</a>> wrote:</div><div><br></div><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div><blockquote type="cite"><font color="#000000">[snip]</font></blockquote></div></div><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br>For example, in fadd X, Y if X is a NaN, is it possible, by varying Y, to get every possible bit pattern for the result?</div></blockquote><div dir="auto"><br></div><div dir="auto">No; you can only get bit patterns that encode NaN values.</div><br><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Alternatively, is there a bit pattern that would cause the fadd to trap?</div></blockquote><div><br></div><div>Not without additional assumptions of the fp environment.  </div><br><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Same question for every other possible value for X.  If for every X, one of the answers is "yes" then it is OK to fold "fadd X, undef" to "undef", otherwise it is not OK.  Because folding to undef means every possible bit pattern for the result can occur.  If it is not OK, it might still be OK with fast-math since we can ignore NaN's and some other oddities.<br></div></blockquote><div><br></div><div>For nearly every fp value X, there are *many* values of Z such that no Y satisfies X + Y = Z.  (Any Z smaller in magnitude than (magnitude of X)/2**(significand bits) suffices).  It sounds like the definition of undef might be overly restrictive for floating-point optimization?</div><br><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Another way to get undef is if there is some bit pattern for Y that the IEEE<br>standard doesn't give a meaning to, in which case we can imagine that the undef<br>was this bit pattern and then we can assign any value we like to the fadd.<br></div></blockquote><div><br></div><div>All IEEE-754 bit patterns have specified meanings.</div><br><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">If undef can't be achieved, it might still be possible to fold to a NaN or some other special value.<br></div></blockquote><div><br></div><div>Folding to NaN sounds workable to me.<br></div><div><br></div><div>- Steve</div><blockquote type="cite"></blockquote></div><br></body></html>