aboutsummaryrefslogtreecommitdiffstats
path: root/numeric.c
diff options
context:
space:
mode:
authorKouhei Yanagita <yanagi@shakenbu.org>2023-10-14 08:50:59 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-10-14 11:22:42 +0900
commitb28c1d2c5644c726bba60cd35ce9313da6e86a4f (patch)
tree48902331bfab04912c91760e615c1b668f58dbae /numeric.c
parent25072d2e878ea6093f04c67e90c5cef33d70080a (diff)
downloadruby-b28c1d2c5644c726bba60cd35ce9313da6e86a4f.tar.gz
[Bug #19926] Fix Range#size for ranges with a Rational endpoint
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/numeric.c b/numeric.c
index 82967502e6..1890f88c7c 100644
--- a/numeric.c
+++ b/numeric.c
@@ -2834,7 +2834,7 @@ ruby_num_interval_step_size(VALUE from, VALUE to, VALUE step, int excl)
}
if (RTEST(rb_funcall(from, cmp, 1, to))) return INT2FIX(0);
result = rb_funcall(rb_funcall(to, '-', 1, from), id_div, 1, step);
- if (!excl || RTEST(rb_funcall(rb_funcall(from, '+', 1, rb_funcall(result, '*', 1, step)), cmp, 1, to))) {
+ if (!excl || RTEST(rb_funcall(to, cmp, 1, rb_funcall(from, '+', 1, rb_funcall(result, '*', 1, step))))) {
result = rb_funcall(result, '+', 1, INT2FIX(1));
}
return result;