Returns arg converted to a float.
Numeric types are converted directly
Strings can have ‘,’ (which are removed) or end in `/LlFf/` (pig format); they should other conform to numeric representation or an error is raised. (this differs from the behavior of String#to_f)
Strings in radix format (an exact hexadecimal encoding of a number) are properly interpreted.
Octal is not interpreted! This means an IntegerFactory receiving ‘011’ will get 9, a FloatFactory 11.0
Other types are converted using obj.to_f.
@example
GraciousFloatFactory.receive(1) #=> 1.0 GraciousFloatFactory.receive("123.456") #=> 123.456 GraciousFloatFactory.receive("0x1.999999999999ap-4" #=> 0.1 GraciousFloatFactory.receive("1_234.5") #=> 1234.5
@example GraciousFloatFactory is generous in some cases where FloatFactory is not
GraciousFloatFactory.receive("1234.5f") #=> 1234.5 GraciousFloatFactory.receive("1,234.5") #=> 1234.5 GraciousFloatFactory.receive("1234L") #=> 1234.0
@example GraciousFloatFactory is not as gullible as to_f
GraciousFloatFactory.receive("7eleven") #=> (error) GraciousFloatFactory.receive("nonzero") #=> (error)
Generated with the Darkfish Rdoc Generator 2.