<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 22, 2016, at 8:13 AM, Stephen Canon via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><pre style="box-sizing: border-box; overflow: auto; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 14px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; padding: 16px; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: normal; word-break: normal; color: rgb(51, 51, 51);" class="">  <span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">/// A signaling NaN (not-a-number).</span>
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">@warn_unused_result</span>
  <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">static</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> signalingNaN: <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">Self</span> { <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">get</span> }
</pre></div><div class=""><br class=""></div><div class="">I’m not sure it really makes sense for a Bignum / APFloat type to support such a value. But really I think this is just underspecified. What does it mean, in terms of this protocol and its uses, for a NaN to be signaling? Is it just a specific “color" of NaN, with no semantic requirements other than being distinguishable?</div></div></div></blockquote></div></div></div></blockquote><div><br class=""></div>I’m confused in that I haven’t really had exposure to signaling NaNs before, and wasn’t really able to find hints on how they are used. Do math operations create signaling NaNs, or is it an explicitly set value?</div><div><br class=""></div><div>My first expectation was that you would either have overflow operators where a NaN result would immediately raise an exception.</div><div><br class=""></div><div>My second expectation if NaN was a valid value but use created exceptions is that floating point numbers are monadic. Specifically, floating point operations with soft NaN seem similar to optional, while Floats with signaling NaN seem similar to implicitly unwrapped optionals - but without the use of separate types to represent numbers and possibly-not-numbers.</div><div><br class=""></div><div>That said, would use of an attribute on a floating point type, similar to what is planned for IUOs, be appropriate to indicate that the type should be treated as signaling?</div><div><br class=""></div><div>-DW</div><div>&nbsp;</div></body></html>