Fix #814: raise on div-0, add inf isinf nan isnan

This commit is contained in:
Nicolas Williams committed 2015-06-17 19:58:55 -05:00
1 parent bdc1feb50e
commit b9c2a326ba
8 files changed
+477 -388

No files matched your search

+6 -1
View File
@@ -1,7 +1,8 @@
%{
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "compile.h"
#include "jv_alloc.h"
#define YYMALLOC jv_mem_alloc
@@ -423,10 +424,14 @@ Exp "*=" Exp {
Exp '/' Exp {
$$ = gen_binop($1, $3, '/');
if (block_is_const_inf($$))
FAIL(@$, "Division by zero?");
} |
Exp '%' Exp {
$$ = gen_binop($1, $3, '%');
if (block_is_const_inf($$))
FAIL(@$, "Remainder by zero?");
} |
Exp "/=" Exp {