From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e7e6e919cef50811,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-03-14 01:47:54 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.net.uni-c.dk!uninett.no!not-for-mail From: Reinert Korsnes Newsgroups: comp.lang.ada Subject: comparing gnat/Ada95 and g77 Date: Thu, 14 Mar 2002 10:47:18 +0100 Organization: UNINETT news service Message-ID: NNTP-Posting-Host: sthrkou.ffi.no Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: snipp.uninett.no 1016099273 20012 193.156.99.159 (14 Mar 2002 09:47:53 GMT) X-Complaints-To: news-abuse@uninett.no User-Agent: KNode/0.6.1 Xref: archiver1.google.com comp.lang.ada:21201 Date: 2002-03-14T10:47:18+01:00 List-Id: Hi, Could anybody try these two programs (Ada and Fortran) and see if it is possible to make the Ada version (via compile options) to run as fast as the Fortran version under Linux, gnat and g77 ? reinert -------------------------------------------------------------------- with Ada.Numerics.Generic_Elementary_Functions,Text_IO; use Text_IO; procedure test1 is type Real is Digits 9; package Flt_Io is new Text_IO.Float_Io (Real); package Int_Io is new Text_IO.Integer_Io (Integer); package E_F is new Ada.Numerics.Generic_Elementary_Functions (Real); use E_F,Flt_Io,Int_Io; N : Integer := 10_000_000; M : Integer := N/50; x : Real := 10.0; begin for I in 1 .. N loop x := x + Real(I)/Real(N); x := x*0.5 + 1.0 + sin(x)*cos(x) + sin(x) + cos(x) + sin(x)*sin(x) + cos(x)*cos(x); if I mod M = 0 then Put(I); Put (x,4,7,0); New_Line (1); end if; end loop; end; ------------------------------------------------------------------------ program test1 c integer i real x c double precision x N = 10000000 M = N/50 x = 10.0 do 10 i = 1,N,1 x = x + real(i)/N x = x*0.5 + 1.0 + sin(x)*cos(x) + sin(x) + cos(x) + - sin(x)*sin(x) + cos(x)*cos(x) if(mod(i,M).eq.0) print *,i,x 10 continue end ------------------------------------------------------------------------------