detect division by 0

This commit is contained in:
Jeff Wang
2019-04-05 01:07:42 -04:00
parent ef298cddd0
commit 20946c44d4
4 changed files with 42 additions and 5 deletions

View File

@ -48,7 +48,11 @@ __xdata dec80* get_y(void){
}
static void do_binary_op(void (*f_ptr)(dec80*, const dec80*)){
f_ptr(&stack(STACK_Y), &stack(STACK_X));
if (decn_is_nan(&stack(STACK_Y)) || decn_is_nan(&stack(STACK_X))){
set_dec80_NaN(&stack(STACK_Y));
} else {
f_ptr(&stack(STACK_Y), &stack(STACK_X));
}
pop();
}