__sub__¶
- array.__sub__(other: int | float | array, /) array ¶
Calculates the difference for each element of an array instance with the respective element of the array
other
. The result ofself_i - other_i
must be the same asself_i + (-other_i)
and must be governed by the same floating-point rules as addition (seearray.__add__()
).- Parameters:
self (array) – array instance (minuend array). Should have a numeric data type.
other (Union[int, float, array]) – subtrahend array. Must be compatible with
self
(see Broadcasting). Should have a numeric data type.
- Returns:
out (array) – an array containing the element-wise differences. 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
subtract()
.