diff options
Diffstat (limited to 'lib/js/urweb.js')
-rw-r--r-- | lib/js/urweb.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js index d7bb7b6f..f05957a0 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -19,9 +19,9 @@ function plus(x, y) { return x + y; } function minus(x, y) { return x - y; } function times(x, y) { return x * y; } function div(x, y) { return x / y; } -function divInt(x, y) { var n = x / y; return n < 0 ? Math.ceil(n) : Math.floor(n); } +function divInt(x, y) { if (y == 0) er("Division by zero"); var n = x / y; return n < 0 ? Math.ceil(n) : Math.floor(n); } function mod(x, y) { return x % y; } -function modInt(x, y) { var n = x % y; return n < 0 ? Math.ceil(n) : Math.floor(n); } +function modInt(x, y) { if (y == 0) er("Division by zero"); var n = x % y; return n < 0 ? Math.ceil(n) : Math.floor(n); } function lt(x, y) { return x < y; } function le(x, y) { return x <= y; } |