Returns the absolute value of the given number.
SDK
- Xcode 9.0+
Framework
- Swift Standard Library
Declaration
Parameters
x
A signed number.
Return Value
The absolute value of x
.
Discussion
The absolute value of x
must be representable in the same type. In particular, the absolute value of a signed, fixed-width integer type’s minimum cannot be represented.