The to_f function in Ruby converts the value of the number as a float. If it does not fit in float, then it returns infinity.
Parameter: The function takes the integer which is to be converted to float.
Return Value: The function returns the float value of the number.
5.0 10.0 1678.0 1897.9
51.0 10.78 1690.0 183.0
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.