<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=""><div><blockquote type="cite" class=""><div class="">On 01 Mar 2016, at 20:28, ted van gaalen via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> 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=""> @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> (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=""> </span>/// **Equality is an equivalence relation**</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""> <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=""> </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=""> </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=""> </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 approximately equal 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 <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></body></html>