|
Posted by C B on June 26, 2007, 10:05 pm
Please log in for more thread options
Apparently, "use bignum;" causes problems with looks_like_number.
Background:
My code makes a call to Finance::Math:IRR to compute an Internal Rate of
return.
my call looks like this:
$result = xirr(%HashOfDatesAndCashflows, precision => 0.000001);
This works fine, except that I'm getting answers that are a little off
numerically.
So, in my main .pl file, I added the line:
use bignum;
Which resulted in an error message:
ERROR: precision is not a valid number at /Users/cb/main.pl line 189
After digging around, I discovered that Finance::Math::IRR calls
looks_like_number($x) where $x is set to the value of the precision hash
key.
Sure enough, the debugger reveals that I'm calling xirr with:
'precision' => bless( {
'_m' => [1],
'_es' => '-',
'_e' => [6],
'sign' => '+'
}, 'Math::BigFloat' )
which SHOULD pass the looks_like_number test, but it doesn't.
I can't believe two such frequently-used components are incompatible.
bignyum is included in most Perl builds.
looks_like_number() is part of the perl api according to
http://search.cpan.org/~nwclark/perl-5.8.8/pod/perlapi.pod
What am I doing wrong?
I'm using Perl 5.8.6 under MacOS Darwin
Thanks
CB
----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+
Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
|