Project

General

Profile

Actions

Bug #14805

closed

Enumerator#count is silently limited to int32

Added by amadan (Goran Topic) almost 6 years ago. Updated over 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin17]
[ruby-core:87340]

Description

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!)

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0