Operator

/(_:_:)

Returns the quotient of dividing the first value by the second, rounded to a representable value.

Declaration

static func / (lhs: Double, rhs: Double) -> Double

Parameters

lhs

The value to divide.

rhs

The value to divide lhs by.

Discussion

The division operator (/) calculates the quotient of the division if rhs is nonzero. If rhs is zero, the result of the division is infinity, with the sign of the result matching the sign of lhs.

let x = 16.875
let y = x / 2.25
// y == 7.5

let z = x / 0
// z.isInfinite == true

The / operator implements the division operation defined by the IEEE 754 specification.

Relationships

From Protocol

See Also

Arithmetic

static func + (Double, Double) -> Double

Adds two values and produces their sum, rounded to a representable value.

static func - (Double, Double) -> Double

Subtracts one value from another and produces their difference, rounded to a representable value.

static func * (Double, Double) -> Double

Multiplies two values and produces their product, rounding to a representable value.