The exponent of the floating-point value.
SDK
- Xcode 8.0+
Framework
- Swift Standard Library
Declaration
Discussion
The exponent of a floating-point value is the integer part of the logarithm of the value’s magnitude. For a value x
of a floating-point type F
, the magnitude can be calculated as the following, where **
is exponentiation:
In the next example, y
has a value of 21
, which is encoded as 1
. The significand of y
is therefore 1.34375.
The exponent
property has the following edge cases:
If
x
is zero, thenx
is.exponent Int
..min If
x
is +/-infinity or NaN, thenx
is.exponent Int
.max
This property implements the log
operation defined by the IEEE 754 specification.