summaryrefslogtreecommitdiff
path: root/random.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-01-31 03:15:33 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-01-31 03:15:33 +0000
commitf758195486cbe49c647140a9e1c5623eeebbeaac (patch)
tree7d2c78d56467677cf1787452c3e630229c9bf4bb /random.c
parente13bfb15096a9d12e93055fbe6526d15bc54e20c (diff)
* parse.y (yylex): remove EXPR_CMDARG according to the RHG book.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'random.c')
-rw-r--r--random.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/random.c b/random.c
index b202a02..72fb454 100644
--- a/random.c
+++ b/random.c
@@ -214,6 +214,8 @@ rb_f_rand(argc, argv, obj)
}
vmax = rb_dbl2big(RFLOAT(vmax)->value);
/* fall through */
+ case T_BIGNUM:
+ bignum:
{
long len = RBIGNUM(vmax)->len;
double *buf = ALLOCA_N(double, len);
@@ -227,6 +229,9 @@ rb_f_rand(argc, argv, obj)
max = 0;
break;
default:
+ vmax = rb_Integer(vmax);
+ if (TYPE(vmax) == T_BIGNUM) goto bignum:
+ case T_FIXNUM:
max = NUM2LONG(vmax);
break;
}