gambas-source-code/benchmark/polynom.pl
Benoît Minisini ebaf5d5ac8 [BENCHMARKS]
* NEW: Do less iterations in benchmarks to get the result faster.
* BUG: Fix 'sort.pl' bench.


git-svn-id: svn://localhost/gambas/trunk@7438 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2015-10-31 01:02:58 +00:00

35 lines
406 B
Perl
Executable file

#!/usr/bin/perl -w
use strict;
sub poly($)
{
my $n = 500000;
my $x = $_[0];
my $mu = 10;
my $pu = 0;
my @pol;
foreach (0 .. $n - 1) {
foreach (0 .. 99) {
$pol[$_] = $mu = ($mu + 2) / 2;
}
my $s = 0;
foreach (0 .. 99) {
$s = $x * $s + $pol[$_];
}
$pu += $s;
}
return $pu;
}
my $res;
for (1..2) {
$res = poly(0.2);
print "$res\n";
}