Project

General

Profile

Actions

Bug #19733

closed

Kernel#Rational does not accept prefix 0

Added by sawa (Tsuyoshi Sawada) 11 months ago. Updated 11 months ago.

Status:
Feedback
Assignee:
-
Target version:
-
[ruby-core:113910]

Description

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

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

However, when it comes to Kernel#Integer and Kernel#Rational, the former accepts 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.

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

Also available in: Atom PDF

Like0
Like0Like0Like0Like0