---
title: "init(signOf:magnitudeOf:)"
framework: swift
role: symbol
role_heading: Initializer
path: "swift/double/init(signof:magnitudeof:)"
---

# init(signOf:magnitudeOf:)

Creates a new floating-point value using the sign of one value and the magnitude of another.

## Declaration

```swift
init(signOf sign: Double, magnitudeOf mag: Double)
```

## Discussion

Discussion The following example uses this initializer to create a new Double instance with the sign of a and the magnitude of b: let a = -21.5 let b = 305.15 let c = Double(signOf: a, magnitudeOf: b) print(c) // Prints "-305.15" This initializer implements the IEEE 754 copysign operation.

## See Also

### Converting Floating-Point Values

- [init(_:)](swift/double/init(_:)-1488d.md)
- [init(_:)](swift/double/init(_:)-o1k9.md)
- [init(_:)](swift/double/init(_:)-5h7qh.md)
- [init(_:)](swift/double/init(_:)-aeox.md)
- [init(_:)](swift/double/init(_:)-9z7ob.md)
- [init(_:)](swift/double/init(_:)-7ag2w.md)
- [init(sign:exponent:significand:)](swift/double/init(sign:exponent:significand:).md)
- [init(_:)](swift/double/init(_:)-1oh9r.md)
- [init(truncating:)](swift/double/init(truncating:).md)
