class Float
format
Public Instance Methods
r_to(x)
click to toggle source
# File lib/floatstats.rb, line 4 def r_to(x) num = (self * 10**x).round.to_f / 10**x sprintf("%.#{x}f", num) end
format
# File lib/floatstats.rb, line 4 def r_to(x) num = (self * 10**x).round.to_f / 10**x sprintf("%.#{x}f", num) end