Thanks to MacPerl

MacPerl (Ver. 5.1.4r4 ; ported by Matthias Neeracher -- based on Perl written by Larry Wall) helped me a lot calculating bigger numbers.
Some Scripts

Get Pi
#!/usr/bin/perl

require "BigFloat.pm";
package Math::BigFloat;

$a = time;
$pia = 1;
$phb = &fsqrt(2, 100);
$pib = &fdiv(1, $phb);
$pic = 1 / 4;
$x = 1;

for ($i = 1; $i < 6; $i++) {            # Set times of repetition. 
    $y = $pia;
    $pia = &fdiv(&fadd($pia, $pib), 2);
    $phb = &fmul($pib, $y);
    $pib = &fsqrt($phb, 100);
    $pim = &fsub($pia, $y);
    $pin = &fmul($pim, $pim);
    $phc = &fmul($x, $pin);
    $pic = &fsub($pic, $phc);
    $x = $x * 2;
    $z = &fadd($pia, $pib);
    $piz = &fmul($z, $z);
    $phz = &fmul($pic, 4);
    $pjz = &fdiv($piz, $phz);
    print "$pjz \n";
}
$b = time;
$c = $b - $a;
print "Time spent: $c sec. \n";
Not very elegant. Calling a library (sub-routine) takes a lot of time on the machine I used (Mac Color Classic ; takes some hours for 5 recursions).

Get Fibonacci Number
#!/usr/bin/perl

require "BigInt.pm";
package Math::BigInt;

$a = time;
@fib = (1,1);
$num = 2;
print "1,1,";

for ($i = 1; $i < 499; $i++) {            # Set times of repetition. 
    $x = $fib[$#fib];
    $y = $fib[$#fib - 1];
    $z = &badd($x, $y);

    push(@fib,$z);
    print "$z,";
    $num += 1;
    if ($num % 10 == 0) {
            print "\n";
    }
}
$b = time;
$c = $b - $a;
print "\n  $num numbers made. Time spent: $c sec. \n";
Fibonacci number is a series of (1, 1, 2, 3, 5, 8,...). Took 3 minutes for 500 number series on the machine I used.

Home > Curious Numbers > Pi | Fibonacci
Copyright (c) Kiwada K.
Last Modified : Jan 20, 1999