🌀floating +−⨉÷ int

// 2022.02.15 (+) : operators +, -
// 2022.02.22 (r) : generalize from CGFloat to FloatingPoint

import SwiftUI

extension FloatingPoint {
    
    /// `fp + int`
    static public func + (a: Self, n: Int) -> Self {
        a + Self(n)
    }
    
    /// `fp - int`
    static public func - (a: Self, n: Int) -> Self {
        a - Self(n)
    }
    
    /// `fp * int`
    static public func * (a: Self, n: Int) -> Self {
        a * Self(n)
    }
    
    /// `fp / int`
    static public func / (a: Self, n: Int) -> Self {
        a / Self(n)
    }
}

History

  1. 2022.02.22

Last updated