<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Hadn't thought of roundUp/Down. Makes it so obvious. +10</div><div><br>On 27 Jun 2016, at 18:32, Erica Sadun <<a href="mailto:erica@ericasadun.com">erica@ericasadun.com</a>> wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8"><div class="">I'm with those recommending round, rounded, roundUp, roundedUp, roundDown, </div><div class="">roundedDown, with Remy's precision factored in as needed.</div><div class=""><br class=""></div><div class="">This is usually the point where Dave A wanders in and explains how this can all be </div><div class="">implemented by a single FloatingPoint protocol, with built-in properties</div><div class="">and methods across all FP types in order to limit the API surface area that would be</div><div class="">otherwise affected by creating a whole bunch of native stdlib freestanding functions,</div><div class="">even generic ones.</div><div class=""><br class=""></div><div class="">-- E, starting the "Tailor Swift Simply" party</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 27, 2016, at 12:53 AM, Xiaodi Wu 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="">I disagree: in English, the nouns are floor and ceiling. That's what they should be called.<br class=""><div class="gmail_quote"><div dir="ltr" class="">On Mon, Jun 27, 2016 at 02:41 David Hart <<a href="mailto:david@hartbit.com" class="">david@hartbit.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto" class=""><div class="">Whatever the naming scheme, I would be hesitant to have the non-mutating versions of floor and ceil have different endings, seeing how connected they are. So:</div><div class=""><br class=""></div><div class="">floor, ceil </div><div class="">floored, ceiled </div><div class="">flooring, ceiling</div><div class=""><br class=""></div><div class="">But not a mix.</div></div><div dir="auto" class=""><div class=""><br class="">On 27 Jun 2016, at 07:13, Xiaodi Wu via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>> wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class="">On Mon, Jun 27, 2016 at 12:45 AM, Charlie Monroe via swift-evolution <span dir="ltr" class=""><<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>></span> wrote:<br class=""><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"><div style="word-wrap:break-word" class="">Given the API guidelines, it should be<div class=""><br class=""></div><div class="">rounded, ceiled, floored </div><div class=""><br class=""></div><div class="">for returning the rounded/ceiled/floored value and</div><div class=""><br class=""></div><div class="">round(), ceil(), floor()</div><div class=""><br class=""></div><div class="">would be the mutating variants. Question is where it's not too confusing for anyone knowing these from another language.</div></div></blockquote><div class=""><br class=""></div><div class="">Although colloquially they can be "verbed," ceil[ing] and floor are formally nouns, just like sine, union, etc. So the API guidelines would recommend: `rounded`, `ceiling`, `floor` for the non-mutating version and `round`, `formCeiling`, and `formFloor` for the mutating version.</div><div class=""><br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><div class=""><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jun 25, 2016, at 9:02 PM, Remy Demarest via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>> wrote:</div><br class=""><div class=""><div style="word-wrap:break-word" class=""><div class="">We don't seem to have a rounded() function either as part of FloatingPoint, we should probably have these methods in the end:</div><div class=""><br class=""></div><div class="">func rounded() -> Self</div><div class="">func rounded(withPrecision: Int) -> Self</div><div class=""><br class=""></div><div class="">Along with the 4 other methods proposed below.</div><br class=""><div class=""><blockquote type="cite" class=""><div class="">Le 25 juin 2016 à 11:55, Haravikk via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>> a écrit :</div><br class=""><div class=""><div style="word-wrap:break-word" class=""><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="">On 25 Jun 2016, at 11:06, Karl via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>> wrote:</div><div class=""><div style="word-wrap:break-word" class=""><div class=""><br class=""><ul style="padding-left:2em;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;background-color:rgb(255,255,255)" class=""><li class=""><code style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">floor()</code> and <code style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">ceil()</code>, exactly like C. <code style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">ceiling()</code> is more descriptive and is a <a href="http://mathworld.wolfram.com/CeilingFunction.html" style="color:rgb(64,120,192);text-decoration:none" target="_blank" class="">mathematical term of art</a>.</li><li class=""><code style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">nextIntegralUp()</code> and <code style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">nextIntegralDown()</code> are more descriptive still, but possibly misleading as <code style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;padding:0.2em 0px;margin:0px;background-color:rgba(0,0,0,0.0392157);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px" class="">(4.0).nextIntegralUp() == 4.0</code></li></ul></div></div></div></blockquote>I'm in favour of these capabilities being there, but in terms of naming I've often wondered why it can't just be part of a rounding group of methods like so:</div><div class=""><br class=""></div><div class=""><font face="Monaco" class=""><span style="white-space:pre-wrap" class="">        </span>func roundedUp() -> Self { … }</font></div><div class=""><font face="Monaco" class=""><span style="white-space:pre-wrap" class="">        </span>func roundedUp(withPrecision:Int) -> Self { … }</font></div><font face="Monaco" class=""><span style="white-space:pre-wrap" class="">        </span>func roundedDown() -> Self { … }</font><div class=""><font face="Monaco" class=""><span style="white-space:pre-wrap" class="">        </span>func roundedDown(withPrecision:Int) -> Self { … }</font></div><div class=""><br class=""></div><div class="">Since the methods with implied precision of zero are equivalent to floor and ceiling surely? I know floor and ceiling are pretty common terms, but they're just a form rounding when it comes down to it.</div></div></div></blockquote></div></div></div></blockquote></div></div></div></div></div></blockquote></div></div></div></div></blockquote></div></blockquote></div></div></blockquote></div><br class=""></div></blockquote></body></html>