Returns -1
if this value is negative and 1
if it’s positive; otherwise, 0
.
SDK
- Xcode 7.1+
Framework
- Swift Standard Library
Declaration
Return Value
The sign of this number, expressed as an integer of the same type.
Returns -1
if this value is negative and 1
if it’s positive; otherwise, 0
.
SDK
Framework
The sign of this number, expressed as an integer of the same type.
var magnitude: UInt
The magnitude of this value.
typealias Int .Magnitude
A type that can represent the absolute value of any possible value of this type.
func abs<T>(T) -> T
Returns the absolute value of the given number.