-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
According to CRuby manual, Fixnum#bit_length returns "the bit position of the highest bit which is different to the sign bit". In other words, check 0 bit position for negative numbers.
In JRuby implementation it returns 64 - Long.numberOfLeadingZeros(value).
Long.numberOfLeadingZeros(value) returns 0 if value is negative, so the value is fixed to 64 in the cases.
Environment
- jruby 9.0.4.0 (2.2.2) 2015-11-12 b9fb7aa OpenJDK 64-Bit Server VM 25.77-b03 on 1.8.0_77-b03 +jit [linux-amd64] on CentOS 7 x64
- JRuby 9.0.5.0 (x64) on Windows7 x64
Expected Behavior
p (-1).bit_length # => 0Actual Behavior
p (-1).bit_length # => 64Reactions are currently unavailable