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,1d575f572a099528 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-07 10:32:05 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed1.uni2.dk!news.net.uni-c.dk!uninett.no!ntnu.no!not-for-mail From: Preben Randhol Newsgroups: comp.lang.ada Subject: Re: What is faster Ada or C? Date: Fri, 7 Dec 2001 18:32:03 +0000 (UTC) Organization: Norwegian university of science and technology Message-ID: References: <3c08314d$0$158$9b622d9e@news.freenet.de> <3C0BA624.7A12BFA1@boeing.com> <3C10C26B.AA451459@nbi.dk> <3C10F665.FF7D0E4A@nbi.dk> NNTP-Posting-Host: kiuk0156.chembio.ntnu.no X-Trace: tyfon.itea.ntnu.no 1007749923 15245 129.241.83.82 (7 Dec 2001 18:32:03 GMT) X-Complaints-To: usenet@itea.ntnu.no NNTP-Posting-Date: Fri, 7 Dec 2001 18:32:03 +0000 (UTC) User-Agent: slrn/0.9.7.3 (Linux) Xref: archiver1.google.com comp.lang.ada:17600 Date: 2001-12-07T18:32:03+00:00 List-Id: On 07 Dec 2001 19:26:00 +0200, Aaro Koskinen wrote: > Jacob Sparre Andersen writes: >> Certainly. (On ix86 processors) GNU C++ inlines the sqrt >> operation built into the processor, while GNU Ada makes >> calls to a Sqrt function. > > I thought GNAT could do this as well, there's the following comment in > Numerics.Aux: > -- This package provides the basic computational interface for the generic > -- elementary functions. The C library version interfaces with the routines > -- in the C mathematical library, and is thus quite portable, although it may > -- not necessarily meet the requirements for accuracy in the numerics annex. > -- One advantage of using this package is that it will interface directly to > -- hardware instructions, such as the those provided on the Intel 80x87. > [...] > function Sqrt (X : Double) return Double; > pragma Import (C, Sqrt, "sqrt"); Using Ada.Numerics.Aux result in the same execution time roughly. But now if I remove the Put_Line statement and use -O3 the whole loop is removed by the optimiser :-) Preben -- () Join the worldwide campaign to protect fundamental human rights. '||} {||' http://www.amnesty.org/