Open adailey14 opened 10 years ago
@adailey14 , I was able to solve this issue adding an intermediary variable to the NVP ( #30 ) calculation. I haven't tested it much, but it preserves the original array: https://github.com/tubedude/finance/commit/412118c99c63f62224a7301042c675d155b5efc0
x = [1,2,3] # => [1, 2, 3]
x.npv(1.5) # =>DecNum('2.28')
x # => [1, 2, 3]
the NPV calculation (and probably others) have unexpected side effects on the input array. It will turn all numbers in the input array into DecNums.
Example:
This example is from the rails console using ruby 2.0.0-p353 and rails 3.2.13