INT/SUB

Subtracts one signed integer from another

Input stack: a b

Output stack: c

SUB will subtract of b from a and push it to the top of the stack.

PumpkinDB> +2 +1 INT/SUB
+1

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/SUB +1 EQUAL?.
negative_value : +1 +2 INT/SUB -1 EQUAL?.
empty_stack : [INT/SUB] TRY UNWRAP 0x04 EQUAL?.
empty_stack_1 : [+1 INT/SUB] TRY UNWRAP 0x04 EQUAL?.

results matching ""

    No results matching ""