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-10 08:51:37 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!not-for-mail From: Jacob Sparre Andersen Newsgroups: comp.lang.ada Subject: Re: What is faster Ada or C? Date: Mon, 10 Dec 2001 17:51:35 +0100 Organization: Centre for Chaos and Turbulence Studies, Niels Bohr Institute Message-ID: <3C14E817.8A2E798E@nbi.dk> References: <3c08314d$0$158$9b622d9e@news.freenet.de> <3C0BA624.7A12BFA1@boeing.com> <3C10C26B.AA451459@nbi.dk> <3C10F77E.6BDD9A3B@nbi.dk> <5ee5b646.0112090427.1a26ecde@posting.google.com> NNTP-Posting-Host: alf.nbi.dk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.net.uni-c.dk 1008003096 14804 130.225.212.55 (10 Dec 2001 16:51:36 GMT) X-Complaints-To: usenet@news.net.uni-c.dk NNTP-Posting-Date: Mon, 10 Dec 2001 16:51:36 +0000 (UTC) X-Mailer: Mozilla 4.78 [en] (X11; U; OSF1 V4.0 alpha) X-Accept-Language: fo,da,no,sv,is,de,fr,en Xref: archiver1.google.com comp.lang.ada:17685 Date: 2001-12-10T17:51:35+01:00 List-Id: Robert Dewar wrote: > Jacob Sparre Andersen wrote in message news:<3C10F77E.6BDD9A3B@nbi.dk>... > > When I look at the corresponding assembler code (gnatgcc > > -S/g++ -S) I can see that GNU C++ inlines the square root > > function, while GNU Ada doesn't. > > You seem to be assuming that the function called square root in C++ > and the function called square root in Ada > are the same function, Correct. > presumably because their names > are similar, and both are usable in your context, but they > are not at all the same routine. The Ada routine has additional > semantics not present in the C++ routine (e.g. > the handling of -0.0 which is required to return -0.0). I had forgotten (or had not noticed) this. > Those extra tests take significant time. Now one can sit > back and say "Ada is a junk language, it insists on testing > for errors at runtime, and in giving accurate IEEE results, > and I don't need either", I happen to need accurate results, and I appreciate being able to specify things like the number of significant digits in my floating point types. But I am (as a physicist) not used to -0.0 being different from +0.0, nor to being unable to calculate the square root of -0.0, as your explanations seem to indicate that IEEE floating point processors are. > but that's not a very reasonable > position given that if you like you can easily call the > C routine directly, since Ada, unlike other languages, > carefully defines the syntax and semantics of calling routines written > in other languages :-) Since I - in the example program - know that the values will never get close to zero, I suppose that I can use the C function "sqrt". Jacob -- I teorien lyver folk ikke i retten.