Actions
Bug #9574
closedInconsistent behavior between Kernel#Float and to_f
Description
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.
Actions
Like0
Like0Like0Like0Like0