From: e@... Date: 2014-05-25T01:42:33+00:00 Subject: [ruby-core:62734] [ruby-trunk - Bug #9574] [Assigned] Inconsistent behavior between Kernel#Float and to_f Issue #9574 has been updated by Zachary Scott. Status changed from Open to Assigned Assignee set to Zachary Scott Thanks for the report! ---------------------------------------- Bug #9574: Inconsistent behavior between Kernel#Float and to_f https://bugs.ruby-lang.org/issues/9574#change-46858 * Author: Robin Dupret * Status: Assigned * Priority: Normal * Assignee: Zachary Scott * Category: doc * Target version: * ruby -v: 2.1.0 * Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN ---------------------------------------- Hello, Sorry if this has still been requested, I haven't found anything about this on the tracker. There is an inconsistent behavior between #to_f and Float() with strings. I don't know whether this is intended or not but if it is, there is at least something wrong in Kernel#Float's documentation:
Numeric types are converted directly, the rest are converted using arg.to_f.>> "123.".to_f => 123.0 >> Float("123.") ArgumentError: invalid value for Float(): "123." from (pry):1:in `Float' The issue has been originally reported here https://github.com/rails/rails/issues/11800. Have a nice day. -- https://bugs.ruby-lang.org/