note
fenLisesi
<code>
#!/usr/bin/perl -wTl
use strict;
use warnings;
use bignum 'bexp'; ## get the latest from CPAN
use Memoize;
use constant MAX_POWER => 30;
use constant MAX_DIGITS => 50;
my $X = shift || 1;
memoize('my_factorial');
my $best = bexp( $X, MAX_DIGITS );
my $estimate = 1;
for my $i (1 .. MAX_POWER) {
$estimate += ($X ** $i) / my_factorial( $i );
print join "\n", ($i, $best, $estimate,
abs( $best - $estimate ), q());
}
exit( 0 );
##--------------------------------------------------+
sub my_factorial {
my ($n) = @_;
return 1 if $n == 1;
$n * my_factorial( $n - 1 );
}
</code>
652386
652386