Operator: prefix -

``` operator prefix - { associativity precedence }```

Declarations

prefix func -(_: Double)

Calculates the additive inverse of a value.

The unary minus operator (prefix `-`) calculates the negation of its operand. The result is always exact.

``````let x = 21.5
let y = -x
// y == -21.5``````

`operand`: The value to negate.

Declaration

`prefix func -(x: Double) -> Double`
prefix func -(_: Float)

Calculates the additive inverse of a value.

The unary minus operator (prefix `-`) calculates the negation of its operand. The result is always exact.

``````let x = 21.5
let y = -x
// y == -21.5``````

`operand`: The value to negate.

Declaration

`prefix func -(x: Float) -> Float`
prefix func -(_: Float80)

Calculates the additive inverse of a value.

The unary minus operator (prefix `-`) calculates the negation of its operand. The result is always exact.

``````let x = 21.5
let y = -x
// y == -21.5``````

`operand`: The value to negate.

Declaration

`prefix func -(x: Float80) -> Float80`

Declared In

`Float80`, `BinaryFloatingPoint`, `SignedNumeric`