From 0c27d72a0df796b3ffaea2ae1acfe5e86fbe1f27 Mon Sep 17 00:00:00 2001 From: yugui Date: Sun, 4 Jan 2009 14:05:36 +0000 Subject: merges r21298 from trunk into ruby_1_9_1. * 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: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@21322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- range.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'range.c') diff --git a/range.c b/range.c index 0e9b390c39..bcbb9d9218 100644 --- a/range.c +++ b/range.c @@ -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"))) { -- cgit v1.2.3