Method: RubyUnits::Math#sqrt

Defined in:
lib/ruby_units/math.rb

#sqrt(number) ⇒ Numeric, RubyUnits::Unit

Take the square root of a unit or number

Parameters:

Returns:



11
12
13
14
15
16
17
# File 'lib/ruby_units/math.rb', line 11

def sqrt(number)
  if number.is_a?(RubyUnits::Unit)
    (number**Rational(1, 2)).to_unit
  else
    super
  end
end