Skip to content

Commit

Permalink
Fix up / and % when b==0
Browse files Browse the repository at this point in the history
  • Loading branch information
soxfox42 committed May 25, 2023
1 parent 04c48e7 commit 3d233da
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/vm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ export class VM {
break;
case '/':
[a, b] = this.pop(2);
this.push(a * FIX / b);
this.push(b === 0 ? 0 : a * FIX / b);
break;
case '%':
[a, b] = this.pop(2);
this.push(a % b);
this.push(b === 0 ? 0 : a % b);
break;
case 'q':
[a] = this.pop(1);
Expand Down

0 comments on commit 3d233da

Please sign in to comment.