baml.ops.Remainder

The remainder operator, `self % rhs`.

Reference version

Signature

interface baml.ops.Remainder<Rhs extends baml.Concrete>

The remainder operator, self % rhs.

The same Rhs/Output shape as Rust's ops::Rem. The primitive impls pair with baml.ops.Divide: the remainder is that of the truncating division, so it takes the sign of self, not of rhs — -7 % 2 is -1, not 1. That is not a modulo, and so does not agree with Python's %.

An implementation may panic, which throws never does not rule out; a caller working through a generic bound cannot enumerate the panics and must be ready for one it cannot describe. See baml.ops.Add.

Source:<builtin>/baml/ns_ops/math.bamlbytes 6425–6801

Associated types

type Output

Required instance methods

function

rem

(self, rhs: Rhs) -> (Self as baml.ops.Remainder<Rhs>).Output throws never

The remainder of dividing self by rhs.