Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Integer#to_f

int.to_f → float

Converts int to a Float. If int doesn’t fit in a Float, the result is infinity.

See also #to_d #to_i #to_bn #to_int also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1