class Numeric
Public Instance Methods
roundoff(d=0)
click to toggle source
# File lib/classes/tools.rb, line 18 def roundoff(d=0) x = 10**d if self < 0 (self * x - 0.5).ceil.quo(x) else (self * x + 0.5).floor.quo(x) end end