The sign of the floating-point value.
SDK
- Xcode 8.0+
Framework
- Swift Standard Library
Declaration
Discussion
The sign
property is .minus
if the value’s signbit is set, and .plus
otherwise. For example:
Do not use this property to check whether a floating point value is negative. For a value x
, the comparison x
is not necessarily the same as x < 0
. In particular, x
if x
is -0, and while x < 0
is always false
if x
is NaN, x
could be either .plus
or .minus
.