#!/usr/bin/perl

use 5.038;

my $pi = 4*atan2(1,1);
my $bigM = 1e10;

say "My Pi = $pi";

$pi =~ s/3\.(.{10}).+$/$1/;

my @digs = split //, $pi;

say "Last ten decimal digit is $digs[-1]";

my @pos;
for my $i (0,1){
    $pos[$i] = $digs[-1] - (-1 * $i); 
}

$digs[-1] = $pos[0];
my $pi_ten1 = join ("", @digs); 
$digs[-1] = $pos[1];
my $pi_ten2 = join ("", @digs);

say "Now the ten decimals Pi is 3\.$pi_ten1 and 3\.$pi_ten2";

my $arc = 0;
my $dif = 0;
my $dif2 = 0;
for my $p ("3".'.'.$pi_ten1, "3".'.'.$pi_ten2){
    $arc = 2 * $bigM * $p / 8;
    say "The arc corresponding to 45 degrees is $arc";
    $dif2 = $arc - $dif2;
    $dif = $p - $dif;
}
say "The dif in number pi is $dif";
say "The dif in arc distance is $dif2 after a radius of $bigM";


exit 2;






