Returns a tuple containing the high and low parts of the result of multiplying this value by the given value.
Required.
SDK
- Xcode 9.0+
Framework
- Swift Standard Library
Declaration
Parameters
other
The value to multiply this value by.
Return Value
A tuple containing the high and low parts of the result of multiplying this value and other
.
Discussion
Use this method to calculate the full result of a product that would otherwise overflow. Unlike traditional truncating multiplication, the multiplied
method returns a tuple containing both the high
and low
parts of the product of this value and other
. The following example uses this method to multiply two Int8
values that normally overflow when multiplied:
The product of x
and y
is -1920
, which is too large to represent in an Int8
instance. The high
and low
compnents of the result
value represent -1920
when concatenated to form a double-width integer; that is, using result
as the high byte and result
as the low byte of an Int16
instance.