module NewCalculator
Constants
- VERSION
Public Class Methods
div(a = 1, b = 1)
click to toggle source
# File lib/new_calculator.rb, line 16 def self.div(a = 1, b = 1) a.to_f / b.to_f end
factorial(a = 1)
click to toggle source
# File lib/new_calculator.rb, line 20 def self.factorial(a = 1) (1..a).inject(:*) end
mult(a = 1, b = 1)
click to toggle source
# File lib/new_calculator.rb, line 12 def self.mult(a = 1, b = 1) a.to_f * b.to_f end
subtr(a = 0, b = 0)
click to toggle source
# File lib/new_calculator.rb, line 8 def self.subtr(a = 0, b = 0) a.to_f - b.to_f end
sum(a = 0, b = 0)
click to toggle source
# File lib/new_calculator.rb, line 4 def self.sum(a = 0, b = 0) a.to_f + b.to_f end