[Shootout-list] takfp bench for Ada

Pascal Obry pascal@obry.net
Thu, 17 Mar 2005 21:50:11 +0100


Here is a version of this bench for Ada that is working properly.

-- The Great Computer Language Shootout
-- http://shootout.alioth.debian.org
--
-- Contributed by Jim Rogers.
-- Fixed by Pascal Obry on 2005/03/17.

with Ada.Text_IO;       use Ada.Text_IO;
with Ada.Long_Float_Text_IO; use Ada.Long_Float_Text_IO;
with Ada.Command_Line;  use Ada.Command_Line;

procedure Takfp is
   function Tak (X, Y, Z : Long_Float) return Long_Float is
   begin
      if Y >= X then
         return Z;
      else
         return Tak
           (Tak (X - 1.0, Y, Z), Tak (Y - 1.0, Z, X), Tak (Z - 1.0, X, Y));
      end if;
   end Tak;
   N : Long_Float := 9.0;
begin
   if Argument_Count > 0 then
      N := Long_Float'Value (Argument (1));
   end if;
   Put (Tak (N * 3.0, N * 2.0, N * 1.0), 0, 1, 0);
   New_Line;
end Takfp;

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595