summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-02 14:48:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-02 14:48:55 +0000
commit7c9a3d19fcacb57463d823d06f579129fa836820 (patch)
tree1acc384bb22a56911d15fd8b5bc17c9b976b92bb /parse.y
parent0eab2b464e6861da0cc55f6dc1c7561e6628c74e (diff)
parse.y: calculate powers of ten
* parse.y (parser_yylex): calculate denominator directly as powers of ten, not parsing string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y4
1 files changed, 1 insertions, 3 deletions
diff --git a/parse.y b/parse.y
index e3c0caabfe..fa90c97ba9 100644
--- a/parse.y
+++ b/parse.y
@@ -7649,9 +7649,7 @@ parser_yylex(struct parser_params *parser)
type = tRATIONAL;
memmove(point, point+1, fraclen+1);
v = rb_cstr_to_inum(tok(), 10, FALSE);
- *point = '1';
- memset(point+1, '0', fraclen);
- v = rb_rational_new(v, rb_cstr_to_inum(point, 10, FALSE));
+ v = rb_rational_new(v, rb_int_positive_pow(10, fraclen));
}
else {
double d = strtod(tok(), 0);