summaryrefslogtreecommitdiffstats
path: root/numeric.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-06 06:51:31 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-06 06:51:31 +0000
commitb50032c8eda65e3aca62f13fd13129e70e8e1138 (patch)
tree112f7e4154e500bf48240f8b4cfaab09e351fd6e /numeric.c
parent28fc7d479b5a06a89f338b1fecb087ef4068b370 (diff)
downloadruby-b50032c8eda65e3aca62f13fd13129e70e8e1138.tar.gz
ruby-b50032c8eda65e3aca62f13fd13129e70e8e1138.tar.xz
ruby-b50032c8eda65e3aca62f13fd13129e70e8e1138.zip
* object.c (rb_obj_methods): list singleton methods if recur
argument is false; list all methods otherwise. * numeric.c (num_step): double epsilon to make "1.1.step(1.5,0.1)" to work. * ext/gdbm/gdbm.c (fgdbm_values_at): new method to replace select(index..). * ext/sdbm/init.c (fsdbm_values_at): ditto. * ext/dbm/dbm.c (fdbm_values_at): ditto. * ext/dbm/dbm.c (DBM::VERSION): defined. * ext/gdbm/testgdbm.rb: replace select with values_at. * ext/sdbm/testsdbm.rb: ditto. * ext/dbm/testdbm.rb: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/numeric.c b/numeric.c
index e0a6011d5..b5d275f89 100644
--- a/numeric.c
+++ b/numeric.c
@@ -905,14 +905,14 @@ num_step(argc, argv, from)
}
}
else if (TYPE(from) == T_FLOAT || TYPE(to) == T_FLOAT || TYPE(step) == T_FLOAT) {
- const double epsilon = DBL_EPSILON;
+ const double epsilon = DBL_EPSILON * 2;
double beg = NUM2DBL(from);
double end = NUM2DBL(to);
double unit = NUM2DBL(step);
double n = (end - beg)/unit;
long i;
- n = floor(n + n*epsilon + 1);
+ n = floor(n + n*epsilon) + 1;
for (i=0; i<n; i++) {
rb_yield(rb_float_new(i*unit+beg));
}