Готовая программа

#!/usr/bin/perl

use warnings;

my $a=shift;

my $tleft=my $hleft=0;
my $tright=my $hright=(1+$a)/2;
my ($tmid, $hmid);

while()
{
	$tmid=($tleft+$tright)/2;
	($tmid**2<$a? $tleft: $tright)=$tmid;

	for(0, 1)
	{
		$hmid=($hleft+$hright)/2;
		($hmid**2<$a? $hleft: $hright)=$hmid;
	}

	last if $tmid==$hmid;
}

print "$tmid\n";
#!/usr/bin/perl

use warnings;

my $a=shift;
my $t=my $h=(1+$a)/2;

while()
{
	$t=($t+$a/$t)/2;
	$h=($h+$a/$h)/2 for 0, 1;
	last if $t==$h;
}
print "$t\n";
#!/usr/bin/perl

use warnings;

my $a=shift;
my $x=(1+$a)/2;
my $y=0;

while()
{
	$y=$x;
	$x=($x+$a/$x)/2;
	last if $x>=$y;
}
print "$x\n";
Информатика-54© А. Н. Швец