Project

General

Profile

Bug #19733

Updated by sawa (Tsuyoshi Sawada) 11 months ago

`Integer` and `Rational` literals accept prefix `0`. There is no difference in this respect. 

 ```ruby 
 0b10 # => 2 
 0b10r # => (2/1) 
 ``` 

 However, when it comes to `Kernel#Integer` and `Kernel#Rational`, the former accepts accept prefix `0` while the latter does not. This is confusing. And as I do not see any reason they should behave differently, I think it is a bug.  

 ```ruby 
 Integer("0b10") # => 2 
 Rational("0b10") # !> ArgumentError 
 ```

Back