niku created JRUBY-6518:
---------------------------
Summary: Array#combination returns unexpected value when argument
number too big.
Key: JRUBY-6518
URL: https://jira.codehaus.org/browse/JRUBY-6518
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.7
Environment: DEBIAN /home/niku% uname -a
Linux debian 2.6.32-5-686 #1 SMP Mon Oct 3 04:15:24 UTC 2011 i686 GNU/Linux
DEBIAN /home/niku% ruby --version
jruby 1.7.0.dev (ruby-1.9.3-p139) (2012-03-02 9913a47) (OpenJDK Client VM
1.6.0_18) [linux-i386-java]
DEBIAN /home/niku% java -version
java version "1.6.0_18"
OpenJDK Runtime Environment (IcedTea6 1.8.13) (6b18-1.8.13-0+squeeze1)
OpenJDK Client VM (build 14.0-b16, mixed mode, sharing)
DEBIAN /home/niku% irb
jruby-1.7.0.dev :001 > RUBY_VERSION
=> "1.9.3"
Reporter: niku
Array#combination returns unexpected value when argument number too big.
This is expected value (argument is 42).
jruby-1.7.0.dev :002 > (1..365).to_a.combination(42).first
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
42]
This is unxepected value (argument is 43).
jruby-1.7.0.dev :003 > (1..365).to_a.combination(43).first
=> nil
I expected non nil value, like this.
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
42, 43]
CRuby on same condition returns expected value.
DEBIAN /home/niku% ruby --version
ruby 1.9.3p125 (2012-02-16 revision 34643) [i686-linux]
DEBIAN /home/niku% irb
1.9.3p125 :001 > (1..365).to_a.combination(43).first
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
42, 43]
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email