Skip to main content

copysign

Return element-wise values of x1 with the sign of x2. Inputs are broadcast together.
Returns: NDArray — Array with magnitudes from x1 and signs from x2.

signbit

Return element-wise true where the sign bit is set (i.e., the value is negative). This correctly detects -0.0.
Returns: NDArray — Boolean array, true where the sign bit is set.

nextafter

Return the next representable floating-point value after x1 towards x2, element-wise. Inputs are broadcast together.
Returns: NDArray — The next representable float after each x1[i] in the direction of x2[i].

spacing

Return the distance between each element and the nearest adjacent representable floating-point number. This is the ULP (unit in the last place) of each value.
Returns: NDArray — The spacing (ULP) for each element.

promote_types

Return the smallest dtype to which both input dtypes can be safely cast. This follows NumPy’s type promotion rules.
Returns: DType — The promoted dtype that can represent values from both input dtypes without loss.