class Axiom::Function::Numeric::SquareRoot

A class representing a square root function

Public Class Methods

call(value) click to toggle source

Return the square root of the value

@example

square_root = SquareRoot.call(value)

@param [Numeric] value

@return [Numeric]

@api public

# File lib/axiom/function/numeric/square_root.rb, line 23
def self.call(value)
  Math.sqrt(value)
end
type() click to toggle source

Return the type returned from call

@example

type = Axiom::Function::Numeric::SquareRoot.type
# => Axiom::Types::Float

@return [Class<Types::Float>]

@api public

# File lib/axiom/function/numeric/square_root.rb, line 36
def self.type
  Types::Float
end

Public Instance Methods

inverse() click to toggle source

Return the inverse function

@example

inverse = square_root.inverse

@return [Exponentiation]

@api public

# File lib/axiom/function/numeric/square_root.rb, line 48
def inverse
  Exponentiation.new(operand, 2).memoize(inverse: self)
end
type() click to toggle source

Return the type returned from call

@example

type = square_root.type  # => Axiom::Types::Float

@return [Class<Types::Float>]

@api public

# File lib/axiom/function/numeric/square_root.rb, line 60
def type
  self.class.type
end