Creates a new floating-point value using the sign of one value and the magnitude of another.
SDK
- Xcode 9.0+
Framework
- Swift Standard Library
Declaration
Parameters
signOf
A value from which to use the sign. The result of the initializer has the same sign as
sign
.Of magnitudeOf
A value from which to use the magnitude. The result of the initializer has the same magnitude as
magnitude
.Of
Discussion
The following example uses this initializer to create a new Double
instance with the sign of a
and the magnitude of b
:
This initializer implements the IEEE 754 copysign
operation.