bundles / numpy 2.4.4 / numpy / fix
_ArrayFunctionDispatcher
numpy:fix
Signature
def fix ( x , out = None ) Summary
Round to nearest integer towards zero.
Extended Summary
Round an array of floats element-wise to nearest integer towards zero. The rounded values have the same data-type as the input.
Parameters
x: array_likeAn array to be rounded
out: ndarray, optionalA location into which the result is stored. If provided, it must have a shape that the input broadcasts to. If not provided or None, a freshly-allocated array is returned.
Returns
out: ndarray of floatsAn array with the same dimensions and data-type as the input. If second argument is not supplied then a new array is returned with the rounded values.
If a second argument is supplied the result is stored there. The return value
outis then a reference to that array.
Examples
import numpy as np
✓np.fix(3.14) np.fix(3)✗
np.fix([2.1, 2.9, -2.1, -2.9])
✓See also
- around
Round to given number of decimals
- ceil
- floor
- rint
- trunc
Aliases
-
numpy.fix