summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-rational/src
diff options
context:
space:
mode:
Diffstat (limited to 'mrbgems/mruby-rational/src')
-rw-r--r--mrbgems/mruby-rational/src/rational.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/mrbgems/mruby-rational/src/rational.c b/mrbgems/mruby-rational/src/rational.c
index 497a36d8e..be9b5eaf9 100644
--- a/mrbgems/mruby-rational/src/rational.c
+++ b/mrbgems/mruby-rational/src/rational.c
@@ -406,7 +406,11 @@ rational_minus(mrb_state *mrb, mrb_value x)
return rational_new(mrb, -p->numerator, p->denominator);
}
-mrb_int mrb_num_div_int(mrb_state *, mrb_int, mrb_int);
+mrb_int mrb_num_div_int(mrb_state*, mrb_int, mrb_int);
+mrb_value mrb_complex_new(mrb_state*, mrb_float, mrb_float);
+#ifndef MRB_NO_FLOAT
+mrb_float mrb_num_div_flo(mrb_state*, mrb_float, mrb_float);
+#endif
/* 15.2.8.3.4 */
/*
@@ -436,7 +440,7 @@ int_div(mrb_state *mrb, mrb_value x)
#ifdef MRB_NO_FLOAT
mrb_raise(mrb, E_TYPE_ERROR, "non integer multiplication");
#else
- return mrb_float_value(mrb, (mrb_float)a * mrb_to_flo(mrb, y));
+ return mrb_float_value(mrb, mrb_num_div_flo(mrb, (mrb_float)a, mrb_to_flo(mrb, y)));
#endif
}
}
@@ -468,7 +472,7 @@ int_quo(mrb_state *mrb, mrb_value x)
#ifdef MRB_NO_FLOAT
mrb_raise(mrb, E_TYPE_ERROR, "non integer multiplication");
#else
- return mrb_float_value(mrb, (mrb_float)a * mrb_to_flo(mrb, y));
+ return mrb_float_value(mrb, mrb_num_div_flo(mrb, (mrb_float)a, mrb_to_flo(mrb, y)));
#endif
}
}