<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 Jun 26, 2016, at 6:38 PM, Károly Lőrentey 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=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; 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; float: none; display: inline !important;" class="">I’m not sure if this has been mentioned yet, but the semantics of Integer operations also needs to be tied down. In particular, the expected behavior of the remainder operation (in all forms) when given a negative numerator and/or denumerator should be explicitly spelled out.</span></div></blockquote><br class=""></div><div>It may not be clearly documented in the stdlib (I haven’t checked), but it definitely *is* tied down. &nbsp;Swift using truncating division, and remainder is defined to satisfy the usual definition of division:</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>a = (a/b)*b + (a%b)</div><div><br class=""></div><div>In particular, this means that if r = a%b, sign(r) == sign(a), and abs(r) &lt; abs(b).</div><div><br class=""></div><div>– Steve</div></body></html>