CARDIAC › rust-cardiac › Message codes › RCE0012
RCE0012error
A wrapping product past the accumulator.
error[RCE0012]: a wrapping * of two values that can pass what the accumulator holds is not supported: {src}
A wrapping multiplication (wrapping_mul, or * without overflow checks) of two u8s or i8s whose product could pass what CARDIAC's accumulator holds. The compiler no longer says this: such a multiplication compiles.
CARDIAC has no multiply: a product is a loop of adds, and where it passes a card the machine's own rule says what is left, as for a sum. A cell keeps the last three digits and the sign (999 + 1 stores 000), and the u8 or i8 then wraps those as Rust wraps any value. A product from -999 to 999 wraps just as Rust's does; past that, the value is CARDIAC's, not Rust's.
With overflow checks on, a product past the type's range panics, as Rust's does.
let y = a.wrapping_mul(b); // 200 × 200 = 40000 is stored as 000: 0, where Rust has 64
In a terminal: cargo cardiac help RCE0012.