Class: Float

Inherits:
Object show all
Defined in:
lib/plist4r/mixin/ruby_stdlib.rb

Instance Method Summary collapse

Instance Method Details

#round(n = 0) ⇒ Object

Round to nearest n decimal places

Examples:

16.347.round(2) => 16.35


220
221
222
# File 'lib/plist4r/mixin/ruby_stdlib.rb', line 220

def round(n=0)
  sprintf("%#{n}.#{n}f", self).to_f
end

#round_origObject



216
# File 'lib/plist4r/mixin/ruby_stdlib.rb', line 216

alias_method :round_orig, :round