__sub__

array.__sub__(other: Union[int, float, array], /) array

Calculates the difference for each element of an array instance with the respective element of the array other. The result of self_i - other_i must be the same as self_i + (-other_i) and must be governed by the same floating-point rules as addition (see array.__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().