module MathRootHelper
Constants
- VERSION
Public Class Methods
cube_root(num)
click to toggle source
# File lib/math_root_helper/root.rb, line 6 def self.cube_root(num) (num**(1.0/3)).round(14) end
nth_root(n, num)
click to toggle source
# File lib/math_root_helper/root.rb, line 10 def self.nth_root(n, num) if n == 0 "Infinity" else (num**(1.0/n)).round(14) end end
square_root(num)
click to toggle source
# File lib/math_root_helper/root.rb, line 2 def self.square_root(num) (num**(1.0/2)).round(14) end