Class: Numeric

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

Instance Method Summary collapse

Instance Method Details

#number_of(n) ⇒ Object



8
9
10
11
# File 'lib/montecasting/numeric.rb', line 8

def number_of(n)
  nmbof = (self.to_f * n.to_f) / 100.0
  nmbof.nan? ? 0 : nmbof
end

#percent_of(n) ⇒ Object



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

def percent_of(n)
  percnt = self.to_f / n.to_f * 100.0
  percnt.nan? ? 0 : percnt
end