<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 22 May 2017, at 15:09, Xiaodi Wu 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="">Let's be clear: it _is_ rounded, just toward zero. It is consistent with the behavior of integer division. I would guess that your students also repeatedly struggle with the result that `2 / 3 == 0`? If so, they have not been taught some important fundamentals of integer arithmetic. If not, then it should be natural that `Int(2 / 3 as Double == Int(2 / 3 as UInt)`.</div></blockquote></div><br class=""><div class="">Just to add my thoughts; but while I agree that it's important developers learn the intricacies of Int vs. Float, I don't think this is quite the same issue as divisions.</div><div class=""><br class=""></div><div class="">If you're asking for an Int then you should have some idea that you're asking for a whole number only, and so that follows on to division as Ints simply cannot handle fractions.</div><div class=""><br class=""></div><div class="">However, for conversion from Float there's an expectation that some rounding must occur, the problem is that it's not as expected; while you or I would expect it to be this way with familiarity of other languages, for someone new to the language this isn't always going to be the case. While it's reasonable to expect new developers to know what an Int is, I think it's unreasonable for them also to remember what the default rounding strategy of an implicitly rounding constructor is.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">For this reason I tend to agree with the principle that the Int(_:Float) constructor should probably be labelled more intuitively, personally I'd like to see:</div><div class=""><br class=""></div><div class=""><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>func&nbsp;init(truncating:Float) { … }</font></div><div class=""><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>func init(rounding:Float, _ strategy:&nbsp;FloatingPointRoundingRule) { … }</font></div><div class=""><br class=""></div><div class="">Here the init(truncating:) constructor is just a convenience form of init(rounding:) with a strategy of .towardZero, which I believe is consistent with the current behaviour. It's also easily swapped in anywhere that init(_:Float) etc. are currently used.</div></body></html>