summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorksss <[email protected]>2014-03-16 23:39:58 +0900
committerksss <[email protected]>2014-03-16 23:39:58 +0900
commit0fab9d557e62a364b0d2d7563c502e07ed53c227 (patch)
tree3a09a19d2359fdffb39415d77eb321a35cb1da61 /src
parent18bebd3acdea1124b3d192ffc171eb6807d391cf (diff)
downloadmruby-0fab9d557e62a364b0d2d7563c502e07ed53c227.tar.gz
mruby-0fab9d557e62a364b0d2d7563c502e07ed53c227.zip
float + nil should be raise TypeError
Diffstat (limited to 'src')
-rw-r--r--src/numeric.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/numeric.c b/src/numeric.c
index 38a05ae92..e2af14b97 100644
--- a/src/numeric.c
+++ b/src/numeric.c
@@ -1306,15 +1306,14 @@ num_cmp(mrb_state *mrb, mrb_value self)
* and <code>other</code>.
*/
static mrb_value
-flo_plus(mrb_state *mrb, mrb_value self)
+flo_plus(mrb_state *mrb, mrb_value x)
{
- mrb_float x, y;
-
- x = mrb_float(self);
- mrb_get_args(mrb, "f", &y);
+ mrb_value y;
- return mrb_float_value(mrb, x + y);
+ mrb_get_args(mrb, "o", &y);
+ return mrb_float_value(mrb, mrb_float(x) + mrb_to_flo(mrb, y));
}
+
/* ------------------------------------------------------------------------*/
void
mrb_init_numeric(mrb_state *mrb)