Expand description
Arithmetic, logical, and bitwise operators.
Constants§
- GCOUNTER_
TAG - Merge one CRDT field by its convergence rule:
Functions§
- add
- approx_
eq a is approximately b— the TOLERANT numeric comparison (==is IEEE bit-exact). Both operands coerce to f64 (approximation is inherently tolerant, so the lossy view is correct here) and compare with the ONE shared isclose definition (logicaffeine_data::ops::logos_approx_eq).- binary_
op - concat
- crdt_
counter_ bump - One CRDT counter step:
current + amount. A CRDT grow-counter is intentionallywrapping(modular) — convergence is defined over the cyclic group, so overflow is a feature here, NOT the silent-corruption footgun that ordinary integer math now promotes away. An absent or Nothing field starts from zero. - crdt_
merge_ field - crdt_
merge_ wire - Merge a wire-encoded CRDT value (from
crdt_to_wire) intolocal, field by field throughcrdt_merge_field— counters add, sets union, registers take the latest. A struct merges each named field; a bare value the unnamed field. Malformed bytes leavelocalunchanged. - crdt_
to_ wire - Encode a CRDT value for the relay wire: a JSON object mapping each Int field
to its value. A bare
Intcounter uses the empty field name.Nothing(and any non-counter value) has nothing to publish. The format is browser-friendly and field-addressable, so structs merge field-by-field on the other side. - divide
- exact_
divide - EXACT division — the runtime of
BinaryOpKind::ExactDivide, the type-directed sibling ofdivide. An evenly-dividing integer pair stays anInt/BigInt; otherwise the quotient is an exactRational(7 / 2 → 7/2) — it NEVER truncates. AFloatoperand divides asFloat(floats are inexact by choice). This only ever runs where the type says the result is aRational, so floor code is untouched. - floor_
divide - FLOOR division — the runtime of
BinaryOpKind::FloorDivide(a // b), the quotient rounded toward NEGATIVE INFINITY. On exact operands (Int/BigInt/Rational/Decimal) the result is the exact quotient’s floor as an integer (-7 // 2 → -4,10^30 // 7exact); a Float operand floors the float quotient but stays Float (7.5 // 2 → 3.0, Python semantics). Distinct fromdivide, which truncates toward zero. Zero divisor is loud. - gcounter_
value - The total of a
GCOUNTER_TAGcounter — the sum of every replica’s count.Nonefor a value that is not a G-Counter. - modulo
- multiply
- not_
value not x— logical negation of truthiness (Bool out). The bitwise complement is~.- power
base ** exp— exponentiation. Integer power is EXACT (i64 fast path, promoting to BigInt on overflow); a Float operand takes thef64::powfpath; a Rational base with an integer exponent stays exact; a NEGATIVE integer exponent on an integer base is a loud error (an Int can’t hold the fractional result — use a Float base). ONE definition, shared by tw/VM/JIT.- seq_
concat a followed by b— merge two sequences into one fresh sequence. Element order is preserved: all ofa, then all ofb. Operands must both be sequences.- subtract