__mul__¶
- array.__mul__(other: int | float | array, /) array ¶
Calculates the product for each element of an array instance with the respective element of the array
other
.Special cases
For floating-point operands, let
self
equalx1
andother
equalx2
.If either
x1_i
orx2_i
isNaN
, the result isNaN
.If
x1_i
is either+infinity
or-infinity
andx2_i
is either+0
or-0
, the result isNaN
.If
x1_i
is either+0
or-0
andx2_i
is either+infinity
or-infinity
, the result isNaN
.If
x1_i
andx2_i
have the same mathematical sign, the result has a positive mathematical sign, unless the result isNaN
. If the result isNaN
, the “sign” ofNaN
is implementation-defined.If
x1_i
andx2_i
have different mathematical signs, the result has a negative mathematical sign, unless the result isNaN
. If the result isNaN
, the “sign” ofNaN
is implementation-defined.If
x1_i
is either+infinity
or-infinity
andx2_i
is either+infinity
or-infinity
, the result is a signed infinity with the mathematical sign determined by the rule already stated above.If
x1_i
is either+infinity
or-infinity
andx2_i
is a nonzero finite number, the result is a signed infinity with the mathematical sign determined by the rule already stated above.If
x1_i
is a nonzero finite number andx2_i
is either+infinity
or-infinity
, the result is a signed infinity with the mathematical sign determined by the rule already stated above.In the remaining cases, where neither
infinity
norNaN
is involved, the product must be computed and rounded to the nearest representable value according to IEEE 754-2019 and a supported rounding mode. If the magnitude is too large to represent, the result is aninfinity
of appropriate mathematical sign. If the magnitude is too small to represent, the result is a zero of appropriate mathematical sign.
Note
Floating-point multiplication is not always associative due to finite precision.
- Parameters:
self (array) – array instance. Should have a numeric data type.
other (Union[int, float, array]) – other array. Must be compatible with
self
(see Broadcasting). Should have a numeric data type.
- Returns:
out (array) – an array containing the element-wise products. The returned array must have a data type determined by Type Promotion Rules.
Note
Element-wise results must equal the results returned by the equivalent element-wise function
multiply()
.