<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>? I don't see transivity requirement broken here, because -within a comparison tolerance- they still are true. &nbsp;</div><div id="AppleMailSignature"><br><br><br><div><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><span style="background-color: rgba(255, 255, 255, 0);">ted van gaalen&nbsp;<b>it</b>&nbsp;services</span></div><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span><div apple-content-edited="true"><div><span style="background-color: rgba(255, 255, 255, 0);">Professional App development for&nbsp;</span></div><div><span style="background-color: rgba(255, 255, 255, 0);">Apple IOS, Windows &nbsp;&amp; Android</span></div><div><span style="background-color: rgba(255, 255, 255, 0);">tablets and mobile phones</span></div><div><span style="background-color: rgba(255, 255, 255, 0);">based on &gt; 30 yrs of IT experience.</span></div><div><span style="background-color: rgba(255, 255, 255, 0);">Web design &amp; programming.</span></div><div><span style="background-color: rgba(255, 255, 255, 0);">IBM Mainframe application programming.</span></div><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><div><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);"><a href="http://www.tedvg.com/" target="_blank">www.tedvg.com</a><br></span></font></div><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><span style="background-color: rgba(255, 255, 255, 0);">Ted F.A. van Gaalen<br><br></span></div><div><font color="#000000"><span style="background-color: rgba(255, 255, 255, 0);"><a href="x-apple-data-detectors://2/0" x-apple-data-detectors="true" x-apple-data-detectors-type="address" x-apple-data-detectors-result="2/0">Hauptstr. 19/3</a><br><a href="x-apple-data-detectors://2/0" x-apple-data-detectors="true" x-apple-data-detectors-type="address" x-apple-data-detectors-result="2/0">D-88636&nbsp;Illmensee</a><br><a href="x-apple-data-detectors://2/0" x-apple-data-detectors="true" x-apple-data-detectors-type="address" x-apple-data-detectors-result="2/0">Germany</a><br>T: &nbsp;<a href="tel:49%207558%2092%2017%20840" x-apple-data-detectors="true" x-apple-data-detectors-type="telephone" x-apple-data-detectors-result="2/1">49 7558 92 17 840</a><br>M:&nbsp;<a href="tel:49%20174%207707%20422" x-apple-data-detectors="true" x-apple-data-detectors-type="telephone" x-apple-data-detectors-result="2/2">49 174 7707 422</a></span></font></div></div></div></div></div></div><div><br>On 01 Mar 2016, at 20:39, Pyry Jahkola &lt;<a href="mailto:pyry.jahkola@iki.fi">pyry.jahkola@iki.fi</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><div><blockquote type="cite" class=""><div class="">On 01 Mar 2016, at 20:28, ted van gaalen via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">in relation to my message about handling floating point number comparisation tolerance in e.g. a .stride function, wouldn't this be better handled by a compiler directive?<br class=""><br class="">For example:<br class=""><br class=""> &nbsp;&nbsp;&nbsp;@floatingPointComparisonTolerance = 0.001<br class=""></div></div></blockquote><br class=""></div><div>I don't think it's a good idea. That directive would break the transitivity requirement of <font face="Menlo" class="">Equatable</font>&nbsp;(the last line below):</div><div><br class=""></div><div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp;&nbsp;</span>/// **Equality is an equivalence relation**</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #008400" class="">///</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span>/// - `x == x` is `true`</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span>/// - `x == y` implies `y == x`</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><b class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; </span>/// - `x == y` and `y == z` implies `x == z`</b></div><div class=""><br class=""></div><div>You might want to define another operator or function for&nbsp;approximately equal&nbsp;instead.</div><div><br class=""></div><div><blockquote type="cite" class=""></blockquote></div><div class="">(Not like equality wasn't already broken for floats because of&nbsp;<font face="Menlo" class="">NaN</font>, but at least we can try to keep the remaining semantics sane.)</div><div class=""><br class=""></div><div class="">— Pyry</div></div></div></blockquote></body></html>