F[size]/ADD

Sums two sized floats, either f32 or f64.

Input stack: a b

Output stack: c

ADD will push the sum of a and b (both 32 bit floats) to the top of the stack.

PumpkinDB> 1.0f32 2.5f32 F32/ADD
0xc0600000

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

Tests

works_32 : 1.0f32 +2.5f32 F32/ADD 3.5f32 EQUAL?.
neg_works_32 : -1.0f32 -2.5f32 F32/ADD -3.5f32 EQUAL?.
neg_pos_works_32 : -1.0f32 2.5f32 F32/ADD 1.5f32 EQUAL?.
int_arg_fails_32 : [1.0f32 1 F32/ADD] TRY UNWRAP 0x03 EQUAL?.
empty_stack_32 : [F32/ADD] TRY UNWRAP 0x04 EQUAL?.
empty_stack_1_32 : [1.0f32 F32/ADD] TRY UNWRAP 0x04 EQUAL?.
works_64 : 1.0f64 +2.5f64 F64/ADD 3.5f64 EQUAL?.
neg_works_64 : -1.0f64 -2.5f64 F64/ADD -3.5f64 EQUAL?.
neg_pos_works_64 : -1.0f64 2.5f64 F64/ADD 1.5f64 EQUAL?.
int_arg_fails_64 : [1.0f64 1 F64/ADD] TRY UNWRAP 0x03 EQUAL?.
empty_stack_64 : [F64/ADD] TRY UNWRAP 0x04 EQUAL?.
empty_stack_1_64 : [1.0f64 F64/ADD] TRY UNWRAP 0x04 EQUAL?.

results matching ""

    No results matching ""