module MetaheuristicAlgorithms::CalculationHelper

Public Instance Methods

bigdecimal_acos(cos_value) click to toggle source
# File lib/metaheuristic_algorithms/calculation_helper.rb, line 37
def bigdecimal_acos(cos_value)
  BigDecimal(Math.acos(cos_value.to_f).to_s)
end
bigdecimal_asin(sin_value) click to toggle source
# File lib/metaheuristic_algorithms/calculation_helper.rb, line 33
def bigdecimal_asin(sin_value)
  BigDecimal(Math.asin(sin_value.to_f).to_s)
end
bigdecimal_atan2(y, x) click to toggle source
# File lib/metaheuristic_algorithms/calculation_helper.rb, line 41
def bigdecimal_atan2(y, x)
  BigDecimal(Math.atan2(y.to_f, x.to_f).to_s)
end
bigdecimal_cos(angle_in_radian) click to toggle source
# File lib/metaheuristic_algorithms/calculation_helper.rb, line 21
def bigdecimal_cos(angle_in_radian)
  BigDecimal(Math.cos(angle_in_radian.to_f).to_s)
end
bigdecimal_exp(bigdecimal_value) click to toggle source
# File lib/metaheuristic_algorithms/calculation_helper.rb, line 17
def bigdecimal_exp(bigdecimal_value)
  BigDecimal(Math.exp(bigdecimal_value.to_f).to_s)
end
bigdecimal_sin(angle_in_radian) click to toggle source
# File lib/metaheuristic_algorithms/calculation_helper.rb, line 25
def bigdecimal_sin(angle_in_radian)
  BigDecimal(Math.sin(angle_in_radian.to_f).to_s)
end
bigdecimal_sqrt(bigdecimal_value) click to toggle source
# File lib/metaheuristic_algorithms/calculation_helper.rb, line 45
def bigdecimal_sqrt(bigdecimal_value)
  BigDecimal(Math.sqrt(bigdecimal_value.to_f).to_s)
end
bigdecimal_tan(angle_in_radian) click to toggle source
# File lib/metaheuristic_algorithms/calculation_helper.rb, line 29
def bigdecimal_tan(angle_in_radian)
  BigDecimal(Math.tan(angle_in_radian.to_f).to_s)
end
degree_to_radian(degree) click to toggle source
# File lib/metaheuristic_algorithms/calculation_helper.rb, line 7
def degree_to_radian(degree)
  # degree * BigDecimal(Math::PI.to_s) / BigDecimal('180')
  degree * Math::PI / 180
end
radian_to_degree(radian) click to toggle source
# File lib/metaheuristic_algorithms/calculation_helper.rb, line 12
def radian_to_degree(radian)
  # radian * BigDecimal('180') / BigDecimal(Math::PI.to_s)
  radian * 180 / Math::PI
end