summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro Matsumoto <[email protected]>2012-05-24 21:10:23 +0900
committerYukihiro Matsumoto <[email protected]>2012-05-24 21:10:23 +0900
commitd9227aa41d8e626e7ff706f2d8cb94fea08658a9 (patch)
tree7182e564c665056820d0ecc47394c0cabeadfaf3 /src
parent34d9043c81e8db4d40f65334e025c36a1b7bc179 (diff)
downloadmruby-d9227aa41d8e626e7ff706f2d8cb94fea08658a9.tar.gz
mruby-d9227aa41d8e626e7ff706f2d8cb94fea08658a9.zip
remove ZeroDivisionError since mruby gives float for integer division
Diffstat (limited to 'src')
-rw-r--r--src/error.c2
-rw-r--r--src/numeric.c26
2 files changed, 1 insertions, 27 deletions
diff --git a/src/error.c b/src/error.c
index 5b32e3a00..feaa04af7 100644
--- a/src/error.c
+++ b/src/error.c
@@ -443,7 +443,7 @@ mrb_init_exception(mrb_state *mrb)
#ifdef INCLUDE_ENCODING
mrb_define_class(mrb, "EncodingError", mrb->eStandardError_class);
#endif
- mrb_define_class(mrb, "ZeroDivisionError", mrb->eStandardError_class); /* 15.2.30 */
+ // mrb_define_class(mrb, "ZeroDivisionError", mrb->eStandardError_class); /* 15.2.30 */
mrb_define_class(mrb, "FloatDomainError", eRangeError);
mrb_define_class(mrb, "KeyError", eIndexError);
diff --git a/src/numeric.c b/src/numeric.c
index 09d55a5de..f26dda424 100644
--- a/src/numeric.c
+++ b/src/numeric.c
@@ -37,12 +37,6 @@
#define fmod(x,y) fmodf(x,y)
#endif
-void
-mrb_num_zerodiv(mrb_state *mrb)
-{
- mrb_raise(mrb, E_ZERODIVISION_ERROR, "divided by 0");
-}
-
static mrb_float
mrb_to_flo(mrb_state *mrb, mrb_value val)
{
@@ -252,7 +246,6 @@ flodivmod(mrb_state *mrb, mrb_float x, mrb_float y, mrb_float *divp, mrb_float *
{
mrb_float div, mod;
- if (y == 0.0) mrb_num_zerodiv(mrb);
mod = fmod(x, y);
if (isinf(x) && !isinf(y) && !isnan(y))
div = x;
@@ -744,7 +737,6 @@ fixdivmod(mrb_state *mrb, mrb_int x, mrb_int y, mrb_int *divp, mrb_int *modp)
{
mrb_int div, mod;
- if (y == 0) mrb_num_zerodiv(mrb);
if (y < 0) {
if (x < 0)
div = -x / -y;
@@ -1043,24 +1035,6 @@ fix_to_f(mrb_state *mrb, mrb_value num)
}
/*
- * Document-class: ZeroDivisionError
- *
- * Raised when attempting to divide an integer by 0.
- *
- * 42 / 0
- *
- * <em>raises the exception:</em>
- *
- * ZeroDivisionError: divided by 0
- *
- * Note that only division by an exact 0 will raise that exception:
- *
- * 42 / 0.0 #=> Float::INFINITY
- * 42 / -0.0 #=> -Float::INFINITY
- * 0 / 0.0 #=> NaN
- */
-
-/*
* Document-class: FloatDomainError
*
* Raised when attempting to convert special float values