Class: Veritas::Function::Numeric::SquareRoot
- Inherits:
-
Veritas::Function::Numeric
- Object
- Veritas::Function
- Veritas::Function::Numeric
- Veritas::Function::Numeric::SquareRoot
- Includes:
- Unary::Invertible, Unary
- Defined in:
- lib/veritas/function/numeric/square_root.rb
Overview
A class representing a square root function
Defined Under Namespace
Modules: Methods
Instance Attribute Summary
Attributes included from Operation::Unary
Class Method Summary collapse
-
.call(value) ⇒ Numeric
Return the square root of the value.
Instance Method Summary collapse
-
#inspect ⇒ String
Return a string representing the square root function.
-
#inverse ⇒ Exponentiation
Return the inverse function.
-
#type ⇒ Class<Attribute::Float>
Return the type returned from #call.
Methods included from Unary
Methods included from Comparator
Methods included from Unary::Callable
Methods included from Operation::Unary
Methods included from Immutable
#dup, #freeze, included, #memoize, #memoized
Methods included from AbstractClass
Methods inherited from Veritas::Function
extract_value, #rename, rename_attributes
Methods included from Visitable
Class Method Details
.call(value) ⇒ Numeric
Return the square root of the value
21 22 23 |
# File 'lib/veritas/function/numeric/square_root.rb', line 21 def self.call(value) Math.sqrt(value) end |
Instance Method Details
#inspect ⇒ String
Return a string representing the square root function
55 56 57 |
# File 'lib/veritas/function/numeric/square_root.rb', line 55 def inspect "SQRT(#{operand.inspect})" end |
#inverse ⇒ Exponentiation
Return the inverse function
33 34 35 36 |
# File 'lib/veritas/function/numeric/square_root.rb', line 33 def inverse Exponentiation.new(operand, 2). memoize(:inverse, self) end |
#type ⇒ Class<Attribute::Float>
Return the type returned from #call
43 44 45 |
# File 'lib/veritas/function/numeric/square_root.rb', line 43 def type Attribute::Float end |