diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-08-02 14:48:55 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-08-02 14:48:55 +0000 |
commit | 7c9a3d19fcacb57463d823d06f579129fa836820 (patch) | |
tree | 1acc384bb22a56911d15fd8b5bc17c9b976b92bb /parse.y | |
parent | 0eab2b464e6861da0cc55f6dc1c7561e6628c74e (diff) | |
download | ruby-7c9a3d19fcacb57463d823d06f579129fa836820.tar.gz |
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.y | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -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); |