From: shannonskipper@... Date: 2018-06-01T22:35:22+00:00 Subject: [ruby-core:87348] [Ruby trunk Bug#14805] Enumerator#count is silently limited to int32 Issue #14805 has been updated by shan (Shannon Skipper). It's interestingly also negative on JRuby. Headius noted in the #ruby IRC channel that [this patch](https://gist.github.com/headius/7296808402fd2fae496310cf0baa7239) would fix the issue for JRuby. It's positive in TruffleRuby. It's also positive in Rubinius, but takes about half and hour to calculate and uses ~5GB of RAM. :-O Not sure what's going on there. On the non-Ruby front, it's negative in Crystal-lang too! ~~~ ruby 2147483648.times.count { |n| n } #=> -2147483648 : Int32 ~~~ ---------------------------------------- Bug #14805: Enumerator#count is silently limited to int32 https://bugs.ruby-lang.org/issues/14805#change-72337 * Author: amadan (Goran Topic) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin17] * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- One takes for granted that integers will be promoted into bigints in Ruby when needed. Not so with `Enumerator#count`: 2147483647.times.count # => 2147483647 2147483648.times.count # => -2147483648 (notice the minus!) -- https://bugs.ruby-lang.org/ Unsubscribe: