Argument error in ludcmp when using Newton module

Hi,

I am trying to use bigdecimal/newton for an implementation of XIRR. A
copy of the code I am trying to run can be found here:
http://pastebin.com/VVMB4bRs

When I run the code (Ruby 1.9.2 on Mac OS X 10.6), I get the following
error:

/opt/local/lib/ruby1.9/1.9.1/bigdecimal/ludcmp.rb:84:in div': wrong number of arguments(2 for 1) (ArgumentError) from /opt/local/lib/ruby1.9/1.9.1/bigdecimal/ludcmp.rb:84:in block in
lusolve’
from /opt/local/lib/ruby1.9/1.9.1/bigdecimal/ludcmp.rb:78:in downto' from /opt/local/lib/ruby1.9/1.9.1/bigdecimal/ludcmp.rb:78:in lusolve’
from /opt/local/lib/ruby1.9/1.9.1/bigdecimal/newton.rb:60:in nlsolve' from gistfile1.rb:52:in

Is this because of an error in my program, or something in the
BigDecimal library?

Any assistance in debugging this would be greatly appreciated.

Thanks,
Bill

Hi Bill,

You got the error because your Function#values returned a Float
instead of a BigDecimal.
While BigDecimal#div can take up to two arguments, Float#div takes only
one.
Here is a modified version of your code: http://pastebin.com/C9ratXer
Hope this helps.

Tomo