The magnitude of this value.
SDK
- Xcode 8.3+
Framework
- Swift Standard Library
Declaration
Discussion
For any value x
, x
is .plus
. If x
is not NaN, x
is the absolute value of x
.
The global abs(_:)
function provides more familiar syntax when you need to find an absolute value. In addition, because abs(_:)
always returns a value of the same type, even in a generic context, using the function instead of the magnitude
property is encouraged.