[ruby-core:88529] [Ruby trunk Bug#14805] Enumerator#count is silently limited to int32

From: nagachika00@...
Date: 2018-08-18 03:38:02 UTC
List: ruby-core #88529
Issue #14805 has been updated by nagachika (Tomoyuki Chikanaga).

Backport changed from 2.3: REQUIRED, 2.4: DONE, 2.5: REQUIRED to 2.3: REQUIRED, 2.4: DONE, 2.5: DONE

ruby_2_5 r64432 merged revision(s) 63549,63551,63554.

----------------------------------------
Bug #14805: Enumerator#count is silently limited to int32
https://bugs.ruby-lang.org/issues/14805#change-73585

* Author: amadan (Goran Topic)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin17]
* Backport: 2.3: REQUIRED, 2.4: DONE, 2.5: DONE
----------------------------------------
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: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next