numpy.signbit()

numpy.signbit(x[, out]) =

Returns element-wise True where signbit is set (less than zero).

Parameters:

x : array_like

The input value(s).

out : ndarray, optional

Array into which the output is placed. Its type is preserved and it must be of the right shape to hold the output. See doc.ufuncs.

Returns:

result : ndarray of bool

Output array, or reference to out if that was supplied.

Examples

1
2
3
4
>>> np.signbit(-1.2)
True
>>> np.signbit(np.array([1, -2.3, 2.1]))
array([FalseTrue, False], dtype=bool)
doc_NumPy
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.