From: usa@... Date: 2014-01-29T05:24:44+00:00 Subject: [ruby-dev:47925] [ruby-trunk - Bug #8010] Enumerator#with_index(large_number) Issue #8010 has been updated by Usaku NAKAMURA. backported into ruby_1_9_3 at r44744. ---------------------------------------- Bug #8010: Enumerator#with_index(large_number) https://bugs.ruby-lang.org/issues/8010#change-44684 * Author: Kazuhiro NISHIYAMA * Status: Closed * Priority: Normal * Assignee: * Category: core * Target version: * ruby -v: ruby 2.1.0dev (2013-03-04 trunk 39580) [x86_64-linux] * Backport: ---------------------------------------- Enumerator#with_index の引数で大きな数を指定するとマイナスになったり例外になったりするのはバグでしょうか? % ruby -ve 'p 3.times.with_index(1<<61).to_a' ruby 2.1.0dev (2013-03-04 trunk 39580) [x86_64-linux] [[0, 2305843009213693952], [1, 2305843009213693953], [2, 2305843009213693954]] % ruby -ve 'p 3.times.with_index(1<<62).to_a' ruby 2.1.0dev (2013-03-04 trunk 39580) [x86_64-linux] [[0, -4611686018427387904], [1, -4611686018427387903], [2, -4611686018427387902]] % ruby -ve 'p 3.times.with_index(1<<63).to_a' ruby 2.1.0dev (2013-03-04 trunk 39580) [x86_64-linux] -e:1:in `with_index': bignum too big to convert into `long' (RangeError) from -e:1:in `each' from -e:1:in `to_a' from -e:1:in `
' -- http://bugs.ruby-lang.org/