Operator: *

operator * { associativity left precedence }

Declarations

func *(_: Double, rhs: Double)

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

The multiplication operator (*) calculates the product of its two arguments. For example:

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

The * operator implements the multiplication operation defined by the IEEE 754 specification.

Parameters: lhs: The first value to multiply. rhs: The second value to multiply.

Declaration

func *(lhs: Double, rhs: Double) -> Double
func *(_: Float, rhs: Float)

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

The multiplication operator (*) calculates the product of its two arguments. For example:

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

The * operator implements the multiplication operation defined by the IEEE 754 specification.

Parameters: lhs: The first value to multiply. rhs: The second value to multiply.

Declaration

func *(lhs: Float, rhs: Float) -> Float
func *(_: Float80, rhs: Float80)

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

The multiplication operator (*) calculates the product of its two arguments. For example:

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

The * operator implements the multiplication operation defined by the IEEE 754 specification.

Parameters: lhs: The first value to multiply. rhs: The second value to multiply.

Declaration

func *(lhs: Float80, rhs: Float80) -> Float80
func *(_: Int, rhs: Int)

Multiplies two values and produces their product.

The multiplication operator (*) calculates the product of its two arguments. For example:

2 * 3                   // 6
100 * 21                // 2100
-10 * 15                // -150
3.5 * 2.25              // 7.875

You cannot use * with arguments of different types. To multiply values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) * y              // 21000000

The product of the two arguments must be representable in the arguments' type. In the following example, the result of 21 * 21 is greater than the maximum representable Int8 value:

x * 21                  // Overflow error

Note: Overflow checking is not performed in -Ounchecked builds.

If you want to opt out of overflow checking and ignore any overflow, use the overflow multiplication operator (&*).

x &* 21                // -115

Parameters: lhs: The first value to multiply. rhs: The second value to multiply.

Declaration

func *(lhs: Int, rhs: Int) -> Int
func *(_: Int8, rhs: Int8)

Multiplies two values and produces their product.

The multiplication operator (*) calculates the product of its two arguments. For example:

2 * 3                   // 6
100 * 21                // 2100
-10 * 15                // -150
3.5 * 2.25              // 7.875

You cannot use * with arguments of different types. To multiply values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) * y              // 21000000

The product of the two arguments must be representable in the arguments' type. In the following example, the result of 21 * 21 is greater than the maximum representable Int8 value:

x * 21                  // Overflow error

Note: Overflow checking is not performed in -Ounchecked builds.

If you want to opt out of overflow checking and ignore any overflow, use the overflow multiplication operator (&*).

x &* 21                // -115

Parameters: lhs: The first value to multiply. rhs: The second value to multiply.

Declaration

func *(lhs: Int8, rhs: Int8) -> Int8
func *(_: Int16, rhs: Int16)

Multiplies two values and produces their product.

The multiplication operator (*) calculates the product of its two arguments. For example:

2 * 3                   // 6
100 * 21                // 2100
-10 * 15                // -150
3.5 * 2.25              // 7.875

You cannot use * with arguments of different types. To multiply values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) * y              // 21000000

The product of the two arguments must be representable in the arguments' type. In the following example, the result of 21 * 21 is greater than the maximum representable Int8 value:

x * 21                  // Overflow error

Note: Overflow checking is not performed in -Ounchecked builds.

If you want to opt out of overflow checking and ignore any overflow, use the overflow multiplication operator (&*).

x &* 21                // -115

Parameters: lhs: The first value to multiply. rhs: The second value to multiply.

Declaration

func *(lhs: Int16, rhs: Int16) -> Int16
func *(_: Int32, rhs: Int32)

Multiplies two values and produces their product.

The multiplication operator (*) calculates the product of its two arguments. For example:

2 * 3                   // 6
100 * 21                // 2100
-10 * 15                // -150
3.5 * 2.25              // 7.875

You cannot use * with arguments of different types. To multiply values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) * y              // 21000000

The product of the two arguments must be representable in the arguments' type. In the following example, the result of 21 * 21 is greater than the maximum representable Int8 value:

x * 21                  // Overflow error

Note: Overflow checking is not performed in -Ounchecked builds.

If you want to opt out of overflow checking and ignore any overflow, use the overflow multiplication operator (&*).

x &* 21                // -115

Parameters: lhs: The first value to multiply. rhs: The second value to multiply.

Declaration

func *(lhs: Int32, rhs: Int32) -> Int32
func *(_: Int64, rhs: Int64)

Multiplies two values and produces their product.

The multiplication operator (*) calculates the product of its two arguments. For example:

2 * 3                   // 6
100 * 21                // 2100
-10 * 15                // -150
3.5 * 2.25              // 7.875

You cannot use * with arguments of different types. To multiply values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) * y              // 21000000

The product of the two arguments must be representable in the arguments' type. In the following example, the result of 21 * 21 is greater than the maximum representable Int8 value:

x * 21                  // Overflow error

Note: Overflow checking is not performed in -Ounchecked builds.

If you want to opt out of overflow checking and ignore any overflow, use the overflow multiplication operator (&*).

x &* 21                // -115

Parameters: lhs: The first value to multiply. rhs: The second value to multiply.

Declaration

func *(lhs: Int64, rhs: Int64) -> Int64
func *(_: UInt, rhs: UInt)

Multiplies two values and produces their product.

The multiplication operator (*) calculates the product of its two arguments. For example:

2 * 3                   // 6
100 * 21                // 2100
-10 * 15                // -150
3.5 * 2.25              // 7.875

You cannot use * with arguments of different types. To multiply values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) * y              // 21000000

The product of the two arguments must be representable in the arguments' type. In the following example, the result of 21 * 21 is greater than the maximum representable Int8 value:

x * 21                  // Overflow error

Note: Overflow checking is not performed in -Ounchecked builds.

If you want to opt out of overflow checking and ignore any overflow, use the overflow multiplication operator (&*).

x &* 21                // -115

Parameters: lhs: The first value to multiply. rhs: The second value to multiply.

Declaration

func *(lhs: UInt, rhs: UInt) -> UInt
func *(_: UInt8, rhs: UInt8)

Multiplies two values and produces their product.

The multiplication operator (*) calculates the product of its two arguments. For example:

2 * 3                   // 6
100 * 21                // 2100
-10 * 15                // -150
3.5 * 2.25              // 7.875

You cannot use * with arguments of different types. To multiply values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) * y              // 21000000

The product of the two arguments must be representable in the arguments' type. In the following example, the result of 21 * 21 is greater than the maximum representable Int8 value:

x * 21                  // Overflow error

Note: Overflow checking is not performed in -Ounchecked builds.

If you want to opt out of overflow checking and ignore any overflow, use the overflow multiplication operator (&*).

x &* 21                // -115

Parameters: lhs: The first value to multiply. rhs: The second value to multiply.

Declaration

func *(lhs: UInt8, rhs: UInt8) -> UInt8
func *(_: UInt16, rhs: UInt16)

Multiplies two values and produces their product.

The multiplication operator (*) calculates the product of its two arguments. For example:

2 * 3                   // 6
100 * 21                // 2100
-10 * 15                // -150
3.5 * 2.25              // 7.875

You cannot use * with arguments of different types. To multiply values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) * y              // 21000000

The product of the two arguments must be representable in the arguments' type. In the following example, the result of 21 * 21 is greater than the maximum representable Int8 value:

x * 21                  // Overflow error

Note: Overflow checking is not performed in -Ounchecked builds.

If you want to opt out of overflow checking and ignore any overflow, use the overflow multiplication operator (&*).

x &* 21                // -115

Parameters: lhs: The first value to multiply. rhs: The second value to multiply.

Declaration

func *(lhs: UInt16, rhs: UInt16) -> UInt16
func *(_: UInt32, rhs: UInt32)

Multiplies two values and produces their product.

The multiplication operator (*) calculates the product of its two arguments. For example:

2 * 3                   // 6
100 * 21                // 2100
-10 * 15                // -150
3.5 * 2.25              // 7.875

You cannot use * with arguments of different types. To multiply values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) * y              // 21000000

The product of the two arguments must be representable in the arguments' type. In the following example, the result of 21 * 21 is greater than the maximum representable Int8 value:

x * 21                  // Overflow error

Note: Overflow checking is not performed in -Ounchecked builds.

If you want to opt out of overflow checking and ignore any overflow, use the overflow multiplication operator (&*).

x &* 21                // -115

Parameters: lhs: The first value to multiply. rhs: The second value to multiply.

Declaration

func *(lhs: UInt32, rhs: UInt32) -> UInt32
func *(_: UInt64, rhs: UInt64)

Multiplies two values and produces their product.

The multiplication operator (*) calculates the product of its two arguments. For example:

2 * 3                   // 6
100 * 21                // 2100
-10 * 15                // -150
3.5 * 2.25              // 7.875

You cannot use * with arguments of different types. To multiply values of different types, convert one of the values to the other value's type.

let x: Int8 = 21
let y: Int = 1000000
Int(x) * y              // 21000000

The product of the two arguments must be representable in the arguments' type. In the following example, the result of 21 * 21 is greater than the maximum representable Int8 value:

x * 21                  // Overflow error

Note: Overflow checking is not performed in -Ounchecked builds.

If you want to opt out of overflow checking and ignore any overflow, use the overflow multiplication operator (&*).

x &* 21                // -115

Parameters: lhs: The first value to multiply. rhs: The second value to multiply.

Declaration

func *(lhs: UInt64, rhs: UInt64) -> UInt64