INT/ADD

Sums two signed integers

Input stack: a b

Output stack: c

AND will push the sum of a and b to the top of the stack.

PumpkinDB> +1 +2 INT/ADD
+3

Allocation

Runtime allocations for decoding numbers and heap allocation for the result.

Errors

EmptyStack error if there are less than two items on the stack

InvalidValue error if a or b cannot be signed integers

Tests

works : +2 +1 INT/ADD +3 EQUAL?.
empty_stack : [INT/ADD] TRY UNWRAP 0x04 EQUAL?.
empty_stack_1 : [+1 INT/ADD] TRY UNWRAP 0x04 EQUAL?.

results matching ""

    No results matching ""