Skip to content

Instantly share code, notes, and snippets.

@djsas
Created March 18, 2012 22:39
Show Gist options
  • Save djsas/2083243 to your computer and use it in GitHub Desktop.
Save djsas/2083243 to your computer and use it in GitHub Desktop.
円周率の計算によってPCの性能を測るPerlスクリプト。
use strict;
use bigint;
my($t1,$t2);
my $n=2000;
my $a;
my $b;
my $i;
$t1=times;
$a = $b = 10 ** $n;
for($i = $n * 8 + 1; $i >= 3; $i -= 2) {
$a = int(int($i / 2) * ($a + $b * 2) / $i);
}
$a -= $b;
print("3.$a\n");
$t2=times;
print "<".($t2-$t1).">";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment