bignum incompatible with looks_like_number() ???
- From: C B <cb0@xxxxxxx>
- Date: Wed, 27 Jun 2007 09:17:08 +0700
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
=----
----== 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 =----
.
- Follow-Ups:
- Re: bignum incompatible with looks_like_number() ???
- From: Sisyphus
- Re: bignum incompatible with looks_like_number() ???
- Prev by Date: bignum incompatible with loos_like_number ???
- Next by Date: Re: bignum incompatible with looks_like_number() ???
- Previous by thread: bignum incompatible with loos_like_number ???
- Next by thread: Re: bignum incompatible with looks_like_number() ???
- Index(es):