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

Comments

Projects
None yet
1 participant
@nirvdrum
Copy link
Contributor

commented Mar 17, 2015

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 closed this in 893aefe Mar 17, 2015

@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
You can’t perform that action at this time.