Class: Float

Defined in:
lib/plist4r/mixin/ruby_stdlib.rb

Instance Methods

Instance Method Details

- (Object) round(n = 0) Also known as: round_orig

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