From: "takuto_h (Takuto Hayashi)" Date: 2013-08-01T16:53:22+09:00 Subject: [ruby-core:56301] [ruby-trunk - Feature #8430] Rational number literal Issue #8430 has been updated by takuto_h (Takuto Hayashi). File ratio_lit.patch added Hello. I wrote a patch for the rational number literal and recognized that a part of the proposed feature is confusable. If we accept "1.2r" as "Rational(12, 10)": 1/3r #=> (1/3) 0.4/1.2r #=> 0.33333333333333337 I think this feature's point is that "1/3r" can be seen as "1/3" followed by "r", so it can make us confusing that "0.4/1.2" followed by "r" is not a rational number. The attached file is a patch which accept "3r" and doesn't accept "1.2r". The implementation is also available at: https://github.com/takuto-h/ruby/commit/6827688ee642c3afd57af35af481377a0038a402 Thank you. ---------------------------------------- Feature #8430: Rational number literal https://bugs.ruby-lang.org/issues/8430#change-40791 Author: mrkn (Kenta Murata) Status: Assigned Priority: Normal Assignee: mrkn (Kenta Murata) Category: core Target version: current: 2.1.0 I would like to propose a new literal syntax for rational numbers. The implementation is available in my github repository: https://github.com/mrkn/ruby/commit/8ca0c9a53593e55d67f509fc403df616e2276e3a This patch implements a notation that consists of an integer, "//", and another integer, in a row. The first integer is the numerator, and the second is the denominator. Whitespaces are permitted between them. For example: 1 // 2 == Rational(1, 2) 1 // 1 == Rational(1, 1) 0 // 1 == Rational(0, 1) "0 // 0" occurs syntax error. I think this new syntax isn't conflict with an empty regexp because this implementation doesn't treat // as a binary operator. -- http://bugs.ruby-lang.org/