floor¶
-
floor(x, out=None, **kwargs)¶ Return the floor of the input, element-wise. The ceil of the ndarray x is the largest integer i, such that i <= x. It is often denoted as \(\lfloor x \rfloor\).
Parameters: - x : ndarray or scalar
Input array.
- out : ndarray or None
A location into which the result is stored. If provided, it must have a shape that the inputs fill into. If not provided or None, a freshly-allocated array is returned. The dtype of the output and input must be the same.
Returns: - y : ndarray or scalar
The floor of each element in x, with float dtype. This is a scalar if x is a scalar.
Examples
>>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) >>> np.floor(a) array([-2., -2., -1., 0., 1., 1., 2.]) >>> # if you use parameter out, x and out must be ndarray. >>> a = np.array(1) >>> np.floor(np.array(3.5), a) array(3.) >>> a array(3.)