<!--
{
  "availability" : [
    "macOS: 10.10.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/Float80/init(signOf:magnitudeOf:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s7Float80V6signOf09magnitudeC0A2B_ABtcfc"
  },
  "title" : "init(signOf:magnitudeOf:)"
}
-->

# init(signOf:magnitudeOf:)

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

```
init(signOf sign: Float80, magnitudeOf mag: Float80)
```

## 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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)