Class: Float
- Inherits:
-
Object
- Object
- Float
- Defined in:
- lib/auto12epl.rb
Instance Method Summary collapse
-
#round_down(n = 0) ⇒ Object
function to round down a float to an integer value.
Instance Method Details
#round_down(n = 0) ⇒ Object
function to round down a float to an integer value
8 9 10 |
# File 'lib/auto12epl.rb', line 8 def round_down n=0 n < 1 ? self.to_i.to_f : (self - 0.5 / 10**n).round(n) end |