Project

General

Profile

Feature #10331

String#to_r to recognize negative denominators

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

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

Description

Current behavior or String#to_r does not recognize negative denominators. This can lead to confusing results:

"1/-3".to_r
#=> (1/1)

I propose negative denominators to be recognized.

"1/-3".to_r
#=> (-1/3)

Also available in: Atom PDF