mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* range.c (range_step): allow float step bigger than zero but less
than one. [ruby-dev:34557] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0fc23bda52
commit
c5b0239124
3 changed files with 18 additions and 10 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu May 1 23:35:11 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* range.c (range_step): allow float step bigger than zero but less
|
||||
than one. [ruby-dev:34557]
|
||||
|
||||
Wed Apr 30 20:22:40 2008 James Edward Gray II <jeg2@ruby-lang.org>
|
||||
|
||||
Merged 16241 from trunk.
|
||||
|
|
15
range.c
15
range.c
|
@ -314,16 +314,19 @@ range_step(argc, argv, range)
|
|||
|
||||
b = rb_ivar_get(range, id_beg);
|
||||
e = rb_ivar_get(range, id_end);
|
||||
if (rb_scan_args(argc, argv, "01", &step) == 0) {
|
||||
if (argc == 0) {
|
||||
step = INT2FIX(1);
|
||||
unit = 1;
|
||||
}
|
||||
else if (FIXNUM_P(step)) {
|
||||
unit = NUM2LONG(step);
|
||||
}
|
||||
else {
|
||||
VALUE tmp = rb_to_int(step);
|
||||
unit = rb_cmpint(tmp, step, INT2FIX(0));
|
||||
rb_scan_args(argc, argv, "01", &step);
|
||||
if (FIXNUM_P(step)) {
|
||||
unit = NUM2LONG(step);
|
||||
}
|
||||
else {
|
||||
VALUE tmp = rb_funcall(rb_funcall(b, '+', 1, step), '-', 1, b);
|
||||
unit = rb_cmpint(tmp, step, INT2FIX(0));
|
||||
}
|
||||
}
|
||||
if (unit < 0) {
|
||||
rb_raise(rb_eArgError, "step can't be negative");
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#define RUBY_VERSION "1.8.7"
|
||||
#define RUBY_RELEASE_DATE "2008-04-30"
|
||||
#define RUBY_RELEASE_DATE "2008-05-01"
|
||||
#define RUBY_VERSION_CODE 187
|
||||
#define RUBY_RELEASE_CODE 20080430
|
||||
#define RUBY_RELEASE_CODE 20080501
|
||||
#define RUBY_PATCHLEVEL 5000
|
||||
|
||||
#define RUBY_VERSION_MAJOR 1
|
||||
#define RUBY_VERSION_MINOR 8
|
||||
#define RUBY_VERSION_TEENY 7
|
||||
#define RUBY_RELEASE_YEAR 2008
|
||||
#define RUBY_RELEASE_MONTH 4
|
||||
#define RUBY_RELEASE_DAY 30
|
||||
#define RUBY_RELEASE_MONTH 5
|
||||
#define RUBY_RELEASE_DAY 1
|
||||
|
||||
#ifdef RUBY_EXTERN
|
||||
RUBY_EXTERN const char ruby_version[];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue