Skip to content

Arithmetic Opcodes ​

This section documents the arithmetic instructions available in CandleVM.

For operand encodings, see the executable format reference.

Arithmetic ​

Opcode byteOpcodeOperand bytesBehavior
18Adddestination: register, left: register, right: registerAdds numeric values as f64; finite integral results from 0 through 255 are stored as Byte, otherwise as Number.
19Subdestination: register, left: register, right: registerSubtracts numeric values with the same result narrowing as Add.
20Muldestination: register, left: register, right: registerMultiplies numeric values with the same result narrowing as Add.
21Divdestination: register, left: register, right: registerDivides numeric values. A zero divisor (including negative zero) raises DivisionByZero; otherwise result narrowing is the same as Add.
22Moddestination: register, left: register, right: registerComputes floating-point remainder. A zero divisor raises DivisionByZero; result narrowing is the same as Add.
23Incvalue: registerAdds numeric 1 to the register in place using the normal narrowing rule.
24Decvalue: registerSubtracts numeric 1 from the register in place using the normal narrowing rule.

Numeric operands may be Byte or Number; other value types raise ValueTypeMismatch. In CandleVM, a result that is integral and within 0..255 automatically becomes Byte; other results remain Number.

Built for the Candle ecosystem · Powered by VitePress.