Module: Main::Formulas

Included in:
MathPlus
Defined in:
lib/math_plus/main/formulas.rb

Instance Method Summary collapse

Instance Method Details

#geron(a, b, c) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/math_plus/main/formulas.rb', line 5

def geron(a, b, c)
  Validation::Triangle.three_way_check(a, b, c)
  # find the semiperimeter
  p = (a + b + c) / 2.0
  # calculate the area
  area = Math.sqrt(p * (p - a) * (p - b) * (p - c))
end