Actions
Bug #13134
closedRational() inconsistency
Bug #13134:
Rational() inconsistency
Description
Rational() parses a float, an integer divided by an integer, and a float divided by an integer.
Rational("3.1") #=> (31/10)
Rational("3/2") #=> (3/2)
Rational("3.1/2") #=> (31/20)
But a float is not allowed as a denominator.
Rational("3.1/2.0") #=> ArgumentError
I'd expect the last also passes and results in (31/20), or the third also raises an ArgumentError
A patch to let all pass.
https://github.com/ruby/ruby/compare/trunk...nobu:parse_rat
Actions