Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rb_cmpint difference from MRI #2716

Closed
nirvdrum opened this issue Mar 17, 2015 · 0 comments
Closed

rb_cmpint difference from MRI #2716

nirvdrum opened this issue Mar 17, 2015 · 0 comments

Comments

@nirvdrum
Copy link
Contributor

This probably doesn't affect anyone in the wild, but our rb_cmpint implementation differs from MRI. MRI always normalizes to {-1, 0, 1}. We do that for Bignum, but not Fixnum.

Example:

$ ruby -v
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]

$ ruby -e 'class X; def <=>(other); 99999; end; end; p "abc" <=> X.new'
-1
$ bin/jruby -v
jruby 9.0.0.0-SNAPSHOT (2.2.1) 2015-03-17 6a83754 Java HotSpot(TM) 64-Bit Server VM 24.76-b04 on 1.7.0_76-b13 +jit [linux-amd64]

$ bin/jruby -e 'class X; def <=>(other); 99999; end; end; p "abc" <=> X.new'
-99999
@nirvdrum nirvdrum added this to the 9.0.0.0.pre2 milestone Mar 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant