diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-01-04 02:58:45 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-01-04 02:58:45 +0000 |
commit | badfd187b146c9a597f0bd88bdf9d57797cf353c (patch) | |
tree | 57d614a85c249c770f26fa8eb6d359267d12243b /range.c | |
parent | 103589aa7bc7e0c714db36c897448263365993ff (diff) | |
download | ruby-badfd187b146c9a597f0bd88bdf9d57797cf353c.tar.gz ruby-badfd187b146c9a597f0bd88bdf9d57797cf353c.tar.xz ruby-badfd187b146c9a597f0bd88bdf9d57797cf353c.zip |
* numeric.c (ruby_float_step): extracted from num_step().
* range.c (range_step): uses ruby_float_step() for float range.
[ruby-dev:37691]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'range.c')
-rw-r--r-- | range.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -267,6 +267,8 @@ step_i(VALUE i, void *arg) return Qnil; } +extern int ruby_float_step(VALUE from, VALUE to, VALUE step, int excl); + /* * call-seq: * rng.step(n=1) {| obj | block } => rng @@ -334,6 +336,9 @@ range_step(int argc, VALUE *argv, VALUE range) } } + else if (ruby_float_step(b, e, step, EXCL(range))) { + /* done */ + } else if (rb_obj_is_kind_of(b, rb_cNumeric) || !NIL_P(rb_check_to_integer(b, "to_int")) || !NIL_P(rb_check_to_integer(e, "to_int"))) { |