__abs__

array.__abs__() array

Calculates the absolute value for each element of an array instance (i.e., the element-wise result has the same magnitude as the respective element but has positive sign).

Note

For signed integer data types, the absolute value of the minimum representable integer is implementation-dependent.

Special cases

For floating-point operands, let self equal x.

  • If x_i is NaN, the result is NaN.

  • If x_i is -0, the result is +0.

  • If x_i is -infinity, the result is +infinity.

Parameters:

self (array) – array instance. Should have a numeric data type.

Returns:

out (array) – an array containing the element-wise absolute value. The returned array must have the same data type as self.

Note

Element-wise results must equal the results returned by the equivalent element-wise function abs().