Class: Float

Inherits:
Object
  • Object
show all
Defined in:
lib/merb-ext/other.rb

Instance Method Summary collapse

Instance Method Details

#ceil_to(x) ⇒ Object



13
14
15
# File 'lib/merb-ext/other.rb', line 13

def ceil_to(x)
  (self * 10**x).ceil.to_f / 10**x
end

#floor_to(x) ⇒ Object



17
18
19
# File 'lib/merb-ext/other.rb', line 17

def floor_to(x)
  (self * 10**x).floor.to_f / 10**x
end

#round_to(x) ⇒ Object



9
10
11
# File 'lib/merb-ext/other.rb', line 9

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