Class: Numeric

Inherits:
Object
  • Object
show all
Defined in:
lib/numeric.rb

Instance Method Summary collapse

Instance Method Details

#percent_of(n) ⇒ Object



2
3
4
5
# File 'lib/numeric.rb', line 2

def percent_of(n)
  return Float::INFINITY if n == 0
  (to_f / n.to_f) * 100.0
end