Integer overflow in Range#step

e$B$3$s$P$s$Oe(B sheepman e$B$G$9!#e(B

Range#step e$B$Ke(B integer overflow e$B$,B8:_$7$^$9!#e(B

$ ruby-1.8 -ve ’ (1…2).step(2**31-1){|i| p i}’
ruby 1.8.6 (2007-09-01 patchlevel 5000) [i686-linux]
1
-2147483648
-1

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs