Project

General

Profile

Feature #10332

Rational literal for mixed fractions

Added by sawa (Tsuyoshi Sawada) almost 5 years ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:65442]

Description

Current behavior of rational literal and String#to_r does not recognize mixed fractions. Mixed fraction is not rare, and is frequently used in places such as US length measurement.

drill bits

I propose that rational literal and String#to_r should be extended to handle mixed fractions. Perhaps something like:

8 1/2r #=> (17/2)
"8 1/2".to_r #=> (17/2)

or

(8 1/2)r #=> (17/2)

Also available in: Atom PDF