Home > Archive > PERL Modules > June 2006 > use bigmnum?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
|
|
| harryfmudd [AT] comcast [DOT] net 2006-06-17, 8:04 am |
| gamo wrote:
> #!/usr/local/bin/perl -w
>
> use bignum;
>
> $fact=1;
> for $i (2..1000){
> $fact*=$i;
> }
> print "$fact\n";
> $div = int ($fact/2003);
# This gives NaN for $div when I do it. Though I confess I am not
# sure why, as int appears to be overloaded. But if $div == NaN,
> $resto = $fact - $div*2003;
# is bound to give NaN as well. On the other hand,
$resto = $fact % 2003;
# gives 2 when I run it. So why not code it that way?
> print "$resto\n";
>
> __END__
> this should be 2, not 0 or $fact
>
When I see mysterious and unreproducable results, I always look at versions.
Me:
perl 5.8.6 (built from source)
bignum 0.17
Math::BigFloat 1.51
Math::BigInt 1.77
OS: Darwin 7.9.0 (or, really, Mac OS 10.3.9), though I do not believe
this has anything to do with it.
If you are out of date, you may wish to consider upgrading.
> TIA
>
Or TIO, in my case ;-)
Tom Wyant
| |
|
|
| harryfmudd [AT] comcast [DOT] net 2006-06-17, 9:57 pm |
| gamo wrote:
> On Fri, 16 Jun 2006, harryfmudd [AT] comcast [DOT] net wrote:
>
>
>
>
> Because it says me:
> Can't use an undefined value as an ARRAY reference at
> /usr/local/lib/perl5/5.8.8/Math/BigInt/Calc.pm line 1068.
>
>
>
>
> I'm using 5.8.8
> and the modules that come with it.
>
> Thank you very much.
>
According to Module::CoreList, 5.8.8 comes with the same bignum,
Math::BigFloat, and Math::BigInt I'm running. I don't imagine upgrading
myself to 5.8.8 overnight (though I'll have to sometime).
Maybe someone running your version of Perl can help. Did you build it
yourself, or get it from somewhere?
I'm grasping at straws, though.
Tom Wyant
| |
|
| On Sat, 17 Jun 2006, harryfmudd [AT] comcast [DOT] net wrote:
> According to Module::CoreList, 5.8.8 comes with the same bignum,
> Math::BigFloat, and Math::BigInt I'm running. I don't imagine upgrading myself
> to 5.8.8 overnight (though I'll have to sometime).
>
> Maybe someone running your version of Perl can help. Did you build it
> yourself, or get it from somewhere?
I build it.
>
> I'm grasping at straws, though.
>
> Tom Wyant
>
|
|
|
|
|