Re: use bigmnum
- From: "Sisyphus" <sisyphus1@xxxxxxxxxxxxxxxxx>
- Date: Sun, 18 Jun 2006 10:40:11 +1000
"gamo" <gamo@xxxxxxxxxxxx> wrote in message
news:Pine.LNX.4.64.0606161644010.11351@xxxxxxxxx
#!/usr/local/bin/perl -w
use bignum;
$fact=1;
for $i (2..1000){
$fact*=$i;
}
print "$fact\n";
$div = int ($fact/2003);
$resto = $fact - $div*2003;
# $resto = $fact % 2003;
print "$resto\n";
__END__
---------------------------------------------------
I think that what you wanted to achieve using int() should already be done
for you anyway - and calling int() leads to an error (for me, anyway) -
namely that $div then evaluates as 'NaN'.
However, it also looks like there's a bug in Math::BigInt.
For me $div (without the int call) is being evaluated as:
200892291601145169018323731364455309894800000000000000000000000000000000....
It should be:
200892291601145169018323731364455309894845164358819087640439296270563411....
You should file a bug report about this - or at least let the current
maintainer of the module know.
Both Math::Pari and Math::GMP should yield correct results.
Incidentally, for me (perl 5.8.8), '$resto = $fact % 2003;' evaluates
correctly.
Cheers,
Rob
.
- Follow-Ups:
- Re: use bigmnum
- From: Tim Heaney
- Re: use bigmnum
- From: Tim Heaney
- Re: use bigmnum
- Prev by Date: Re: ANNOUNCE: WWW::YouTube
- Next by Date: Re: use bigmnum
- Previous by thread: CGI::AJAX and header
- Next by thread: Re: use bigmnum
- Index(es):
Relevant Pages
|
|