Plain math (plus minus times pow) is exact, and checked where the value lands: a typed declaration, a change, an argument, a return.
overflow_sites.zg
# Plain math (plus minus times pow) is exact, and checked where the value lands: a typed declaration,# a `change`, an argument, a return (owner, 2026-09-23). In between, the one limit is# the machine's 64 bits. Wrapping (plus.wrap minus.wrap times.wrap pow.wrap) wraps at the size of its values.# tests/reject/overflow_lands.zg and overflow_past_64_bits.zg are the two that fail.MAIN{let'small':int16=5;let'big':int64=(20000plus20000)plus'small';# 40005: the true answer, and it fits int64let's':int16=30000;let'twice':int64='s'plus's';# 60000, though no int16 holds itlet'tiny':int8=(100plus100)minus150;# 50: the 200 in between is finelet'v':int8=112;std::print.useful['big'," ",'twice'," ",'tiny'," ",'v'>('v'plus'v'),newln];# 224 compared as 224let'u':uint8=5;let'below':='u'minus10;# -5: `:=` takes a type that holds itlet'x':uint32=4000000000;let'h':uint64='x'plus.wrap'x';# wraps at uint32, 'x''s size: 3705032704let'a':int8=100;let'b':int16=1000;let'w':=to.int16['a'plus'b']plus.wrap1;# a mix of sizes wraps where you say: 1101std::print.useful['below'," ",'h'," ",'w',newln];}