signbit

Contents

signbit#

class saiunit.math.signbit(x, **kwargs)#

Return element-wise True where the sign bit is set (less than zero).

Units are stripped before the check is performed.

Parameters:

x (Array | ndarray | bool | number | bool | int | float | complex | saiunit.Quantity) – The input value(s).

Returns:

result – Boolean array indicating where the sign bit is set.

Return type:

Array

Examples

>>> import saiunit as u
>>> import jax.numpy as jnp
>>> u.math.signbit(jnp.array([-2.0, 0.0, 3.0]))
Array([ True, False, False], dtype=bool)
>>> q = jnp.array([-1.0, 1.0]) * u.meter
>>> u.math.signbit(q)
Array([ True, False], dtype=bool)