Given the API guidelines, it should be

rounded, ceiled, floored 

for returning the rounded/ceiled/floored value and

round(), ceil(), floor()

would be the mutating variants. Question is where it's not too confusing for 
anyone knowing these from another language.

> On Jun 25, 2016, at 9:02 PM, Remy Demarest via swift-evolution 
> <swift-evolution@swift.org> wrote:
> 
> We don't seem to have a rounded() function either as part of FloatingPoint, 
> we should probably have these methods in the end:
> 
> func rounded() -> Self
> func rounded(withPrecision: Int) -> Self
> 
> Along with the 4 other methods proposed below.
> 
>> Le 25 juin 2016 à 11:55, Haravikk via swift-evolution 
>> <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> a écrit :
>> 
>> 
>>> On 25 Jun 2016, at 11:06, Karl via swift-evolution 
>>> <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:
>>> 
>>> floor() and ceil(), exactly like C. ceiling() is more descriptive and is a 
>>> mathematical term of art 
>>> <http://mathworld.wolfram.com/CeilingFunction.html>.
>>> nextIntegralUp() and nextIntegralDown() are more descriptive still, but 
>>> possibly misleading as (4.0).nextIntegralUp() == 4.0
>> 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:
>> 
>>      func roundedUp() -> Self { … }
>>      func roundedUp(withPrecision:Int) -> Self { … }
>>      func roundedDown() -> Self { … }
>>      func roundedDown(withPrecision:Int) -> Self { … }
>> 
>> 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.
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution@swift.org <mailto:swift-evolution@swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-evolution
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution@swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to