Created
July 25, 2020 04:37
-
-
Save b3ll/afdf32362dcabfafc6d4b0a7975135ee to your computer and use it in GitHub Desktop.
Floating Point Stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public protocol ScalableValue: ExpressibleByFloatLiteral { | |
func scaled(by: Double) -> Self | |
} | |
public extension ScalableValue where Self: FloatingPoint { | |
func scaled(by constant: Double) -> Self { | |
return self * constant | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment