Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
extension SignedNumberType {
/// The absolute value of `self`.
var abs: Self {
return self < 0 ? -self : self
}
}
extension AbsoluteValuable {
/// The absolute value of `self`.
var abs: Self {
return Self.abs(self)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment