abs¶
- abs(x: array, /) array¶
Calculates the absolute value for each element
x_iof the input arrayx(i.e., the element-wise result has the same magnitude as the respective element inxbut 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,
If
x_iisNaN, the result isNaN.If
x_iis-0, the result is+0.If
x_iis-infinity, the result is+infinity.
- Parameters:
x (array) – input array. Should have a numeric data type.
- Returns:
out (array) – an array containing the absolute value of each element in
x. The returned array must have the same data type asx.