<div dir="ltr">On Sun, Apr 23, 2017 at 1:46 AM, David Waite <span dir="ltr">&lt;<a href="mailto:david@alkaline-solutions.com" target="_blank">david@alkaline-solutions.com</a>&gt;</span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
&gt; On Apr 22, 2017, at 10:58 PM, Chris Lattner via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br>
&gt;<br>
&gt; I don’t think that this proposal is acceptable as written.  I think it is really bad that abstracting a concrete algorithm would change its behavior so substantially.  I don’t care about SNaNs, but I do care about the difference between +0/-1 and secondarily that of NaN handling.  It seems really bad that generalizing something like:<br>
&gt;<br>
&gt; func doThing(a : Double, b : Double) -&gt; Bool {<br>
&gt;   ….<br>
&gt;   return a != b<br>
&gt; }<br>
&gt;<br>
&gt; to:<br>
&gt;<br>
&gt; func doThing&lt;T : FloatingPoint&gt; (a : T, b : T) -&gt; Bool {<br>
&gt;   ….<br>
&gt;   return a != b<br>
&gt; }<br>
&gt;<br>
&gt; would change behavior (e.g. when a is -0.0 and b is +0.0).   Likewise, &quot;T : Equatable”.<br>
<br>
</span>Did I misunderstand the proposal? If T : FloatingPoint is not included in level 1 comparisons, then you cannot have classes of generic floating point algorithms.<br>
<br>
I personally feel sets/dictionaries of FloatingPoint keys to be more brittle than other types merely on the basis of the FloatingPoint numbers being an approximation within the real space. Different ways to compute a number may have different rounding errors, which makes container lookup less useful.<br></blockquote><div><br></div><div>This is a very good practical point.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In my opinion this is much more about making generic algorithms relying on equatable/hashable/comparable able to make safe assumptions.<br>
<span class="HOEnZb"><font color="#888888"><br>
-DW</font></span></blockquote></div><br></div></div>