Click here to get back home

bignum incompatible with loos_like_number ???

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
bignum incompatible with loos_like_number ??? C B 06-26-2007
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 =----

Similar ThreadsPosted
bignum incompatible with looks_like_number() ??? June 26, 2007, 10:17 pm
bignum 0.22 July 4, 2007, 9:43 am
Problem around bignum March 28, 2006, 6:04 am
Error in perl module "bignum"... May 14, 2006, 4:31 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap