__truediv__¶
- array.__truediv__(other: int | float | array, /) array ¶
Evaluates
self_i / other_i
for each element of an array instance with the respective element of the arrayother
.Note
If one or both of
self
andother
have integer data types, the result is implementation-dependent, as type promotion between data type “kinds” (e.g., integer versus floating-point) is unspecified.Specification-compliant libraries may choose to raise an error or return an array containing the element-wise results. If an array is returned, the array must have a floating-point data type.
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+infinity
or-infinity
, the result isNaN
.If
x1_i
is either+0
or-0
andx2_i
is either+0
or-0
, the result isNaN
.If
x1_i
is+0
andx2_i
is greater than0
, the result is+0
.If
x1_i
is-0
andx2_i
is greater than0
, the result is-0
.If
x1_i
is+0
andx2_i
is less than0
, the result is-0
.If
x1_i
is-0
andx2_i
is less than0
, the result is+0
.If
x1_i
is greater than0
andx2_i
is+0
, the result is+infinity
.If
x1_i
is greater than0
andx2_i
is-0
, the result is-infinity
.If
x1_i
is less than0
andx2_i
is+0
, the result is-infinity
.If
x1_i
is less than0
andx2_i
is-0
, the result is+infinity
.If
x1_i
is+infinity
andx2_i
is a positive (i.e., greater than0
) finite number, the result is+infinity
.If
x1_i
is+infinity
andx2_i
is a negative (i.e., less than0
) finite number, the result is-infinity
.If
x1_i
is-infinity
andx2_i
is a positive (i.e., greater than0
) finite number, the result is-infinity
.If
x1_i
is-infinity
andx2_i
is a negative (i.e., less than0
) finite number, the result is+infinity
.If
x1_i
is a positive (i.e., greater than0
) finite number andx2_i
is+infinity
, the result is+0
.If
x1_i
is a positive (i.e., greater than0
) finite number andx2_i
is-infinity
, the result is-0
.If
x1_i
is a negative (i.e., less than0
) finite number andx2_i
is+infinity
, the result is-0
.If
x1_i
is a negative (i.e., less than0
) finite number andx2_i
is-infinity
, the result is+0
.If
x1_i
andx2_i
have the same mathematical sign and are both nonzero finite numbers, the result has a positive mathematical sign.If
x1_i
andx2_i
have different mathematical signs and are both nonzero finite numbers, the result has a negative mathematical sign.In the remaining cases, where neither
-infinity
,+0
,-0
, norNaN
is involved, the quotient 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 operation overflows and the result is aninfinity
of appropriate mathematical sign. If the magnitude is too small to represent, the operation underflows and the result is a zero of appropriate mathematical sign.
- 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 results. The returned array should have a floating-point data type determined by Type Promotion Rules.
Note
Element-wise results must equal the results returned by the equivalent element-wise function
divide()
.