trunc¶
- trunc(x: array, /) array¶
Rounds each element
x_iof the input arrayxto the integer-valued number that is closest to but no greater thanx_i.Special cases
If
x_iis already integer-valued, the result isx_i.
For floating-point operands,
If
x_iis+infinity, the result is+infinity.If
x_iis-infinity, the result is-infinity.If
x_iis+0, the result is+0.If
x_iis-0, the result is-0.If
x_iisNaN, the result isNaN.
- Parameters:
x (array) – input array. Should have a numeric data type.
- Returns:
out (array) – an array containing the rounded result for each element in
x. The returned array must have the same data type asx.