From: naruse@... Date: 2019-01-30T06:20:14+00:00 Subject: [ruby-core:91331] [Ruby trunk Bug#15518] good old Infinite range notation behavior Issue #15518 has been updated by naruse (Yui NARUSE). Backport changed from 2.4: DONTNEED, 2.5: DONTNEED, 2.6: REQUIRED to 2.4: DONTNEED, 2.5: DONTNEED, 2.6: DONE ruby_2_6 r66949 merged revision(s) 66947. ---------------------------------------- Bug #15518: good old Infinite range notation behavior https://bugs.ruby-lang.org/issues/15518#change-76582 * Author: sakuro (Sakuro OZAWA) * Status: Closed * Priority: Normal * Assignee: mrkn (Kenta Murata) * Target version: * ruby -v: ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-darwin18] * Backport: 2.4: DONTNEED, 2.5: DONTNEED, 2.6: DONE ---------------------------------------- Ruby 2.5.3's behavior ~~~ # without step, it produces integer sequence (1..Float::INFINITY).first(10) #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] # with step, it produces floats instead of integers (1..Float::INFINITY).step(1).first(10) #=> [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0] ~~~ Ruby 2.6.0's behavior ~~~ # endless range (1..).first(10) #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] # with step, all numbers are integer now (1..).step(1).first(10) #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] # old idiom with Float::INFINITY (1..Float::INFINITY).first(10) #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] (1..Float::INFINITY).step(1).first(10) #=> FloatDomainError (Infinity) ~~~ Which are intended change and which are not? -- https://bugs.ruby-lang.org/ Unsubscribe: