Class: Float

Inherits:
Object
  • Object
show all
Defined in:
lib/float_ext.rb

Instance Method Summary collapse

Instance Method Details

#round_to(x) ⇒ Object



2
3
4
# File 'lib/float_ext.rb', line 2

def round_to(x)
  (self * 10**x).round.to_f / 10**x
end