Created
March 18, 2012 22:39
-
-
Save djsas/2083243 to your computer and use it in GitHub Desktop.
円周率の計算によってPCの性能を測るPerlスクリプト。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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