Issue #210 - Prevent divide-by-zero error

This commit is contained in:
Justin Ethier 2017-08-09 12:41:43 +00:00
parent c925385305
commit f106a1f0a2
2 changed files with 11 additions and 0 deletions

View file

@ -1,5 +1,15 @@
# Changelog # Changelog
## Next Release - TBD
Features
- Added SRFI 143 - Fixnums.
Bug Fixes
- Prevent `remainder` from crashing the runtime due to divide by zero.
## 0.5.4 - August 3, 2017 ## 0.5.4 - August 3, 2017
Features Features

View file

@ -3367,6 +3367,7 @@ void Cyc_remainder(void *data, object cont, object num1, object num2)
j = ((double_type *)num2)->value; j = ((double_type *)num2)->value;
} }
} }
if (j == 0) { Cyc_rt_raise_msg(data, "Divide by zero"); }
result = obj_int2obj(i % j); result = obj_int2obj(i % j);
return_closcall1(data, cont, result); return_closcall1(data, cont, result);
} }