Class: Float
- Inherits:
-
Object
- Object
- Float
- Defined in:
- lib/monetico.rb
Instance Method Summary collapse
Instance Method Details
#big ⇒ Object
6 |
# File 'lib/monetico.rb', line 6 def big; BigDecimal(self.to_s); end |
#round_down(x) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/monetico.rb', line 12 def round_down(x) if self >= 0 (self * 10**x).floor.to_f / 10**x else -((-self * 10**x).floor.to_f / 10**x) end end |
#round_to(x) ⇒ Object
8 9 10 |
# File 'lib/monetico.rb', line 8 def round_to(x) (self * 10**x).ceil.to_f / 10**x end |