On Dec 24, 2015, at 13:22 , Peters, Brandon <[email protected]> wrote:
> 
> I do not see this one being any different from the integer type version.

What’s different is that FloatingPointType doesn’t have any arithmetic 
operators defined on it.

The solution is to add a protocol that requires that behavior:

> protocol ArithmeticFloatingPointType: FloatingPointType
> {
>       func * (lhs: Self, rhs: Self) -> Self
>       func += (inout lhs: Self, rhs: Self)
> }
> 
> extension Double: ArithmeticFloatingPointType {} // These already have the 
> operator that conforms, so nothing to do here
> extension Float: ArithmeticFloatingPointType {}
> 
> func linconv<T: ArithmeticFloatingPointType>(signal_A signal_A: [T], 
> signal_B: [T]) -> [T]? {
> …
> }

You’ll have to expand the new protocol for any other operators you happen to 
use.

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to