def below_zero

bendtorch-core@0.1.0.0 · src/tensor/elementwise.bend:34

import bendtorch-core@0.1.0.0/src/tensor/elementwise.bend as Elementwise
import Base

34# IEEE 754 `x < 0`, on the bits: the words above -0.0 (0x80000000) up to
35# -inf (0xFF800000). -0.0, +0.0 and every NaN are not below zero.
36def below_zero(x: F32) -> Bool:
37  +word = bits(x)
38  Bool.and(U32.is_lt(2147483648, word), U32.is_le(word, 4286578688))

Uses (6)

Used by (8)