Class: Finance::Calculations::Function Private

Inherits:
Object
  • Object
show all
Defined in:
lib/finance/calculations.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Base class for working with Newton’s Method. For more details, see Bigdecimal::Newton.

Instance Method Summary collapse

Constructor Details

#initialize(values) ⇒ Function

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Function.



112
113
114
115
116
117
118
119
# File 'lib/finance/calculations.rb', line 112

def initialize(values)
  @zero   = BigDecimal("0.0")
  @one    = BigDecimal("1.0")
  @two    = BigDecimal("2.0")
  @ten    = BigDecimal("10.0")
  @eps    = BigDecimal("1.0e-16")
  @values = values
end

Instance Method Details

#epsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



125
# File 'lib/finance/calculations.rb', line 125

def eps ; @eps;  end

#oneObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



122
# File 'lib/finance/calculations.rb', line 122

def one ; @one;  end

#tenObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



124
# File 'lib/finance/calculations.rb', line 124

def ten ; @ten;  end

#twoObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



123
# File 'lib/finance/calculations.rb', line 123

def two ; @two;  end

#values(x) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



127
# File 'lib/finance/calculations.rb', line 127

def values(x); [Finance::Calculations.npv(x[0], @values)]; end

#zeroObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



121
# File 'lib/finance/calculations.rb', line 121

def zero; @zero; end