Operator

-(_:)

Calculates the additive inverse of a value.

Declaration

prefix static func - (x: Double) -> Double

Parameters

operand

The value to negate.

Discussion

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

Relationships

See Also

Negation

static func - (Double) -> Double

Returns the additive inverse of the specified value.

static func + (Double) -> Double

Returns the given number unchanged.