def at_most_zero

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

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

40# IEEE 754 `x <= 0`, on the bits: +0.0 (0x00000000) and the words from -0.0
41# (0x80000000) up to -inf (0xFF800000). No NaN is at most zero.
42def at_most_zero(x: F32) -> Bool:
43  +word = bits(x)
44  Bool.or(U32.is_eq(word, 0), Bool.and(U32.is_le(2147483648, word), U32.is_le(word, 4286578688)))

Uses (7)

Used by (5)