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-Thread: a07f3367d7,13280cdb905844e4 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder3.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.84.MISMATCH!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!news.wiretrip.org!news2.arglkargh.de!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Is there an Ada compiler whose Ada.Numerics.Generic_Elementary_Functions.Log(Base=>10, X=>variable) is efficient? Date: Mon, 15 Feb 2010 17:20:01 -0600 Organization: Jacob Sparre Andersen Message-ID: References: NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1266276003 7190 69.95.181.76 (15 Feb 2010 23:20:03 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Mon, 15 Feb 2010 23:20:03 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5843 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Xref: g2news1.google.com comp.lang.ada:9258 Date: 2010-02-15T17:20:01-06:00 List-Id: "Colin Paul Gloster" wrote in message news:alpine.LNX.2.00.1002151055530.17315@Bluewhite64.example.net... > I have been improving a program by suppressing C++ in it. After > speeding it up a lot by making changes, I have found one considerable > part which calls a library routine, which is unfortunately very slow > as provided as standard with a number of Ada compilers but which is > very fast with implementations of other languages. For some Ada > compilers perhaps I shall simply need to not rely on an implementation > of this routine by an Ada vendor. Perhaps this post will motivate Ada > vendors to speed up their implementations or for people to report > timings for efficient implementations which are used by default by > other Ada compilers. I doubt it's possible in general. Ada has strong accuracy requirements on the implementation of Generic_Elementary_Functions, while other languages have little to say. The result is that it isn't possible for Ada to be as fast as possible because those techniques don't have the required accuracy. I haven't worked on this recently, but back in the day, the old 8087 hardware instructions didn't have the required accuracy for Sine and Tangent, so a software solution had to be used (which of course was a lot slower). (Yes, compilers can and do provide faster implementations of these functions that don't meet the accuracy requirements, but those solutions aren't portable in general.) This is a major difference between Ada and most other programming languages: Ada defines error bounds for all numeric operations, so that it's possible to perform useful numeric analysis on an Ada program without knowing any at all about the target hardware. There is of course a cost to that capability. But it is an important capability which rarely is taken advantage of : as noted in a previous thread, without numerical analysis, you have no idea whether the results you are getting has any significance or not. And "not" is far more likely that people like to admit. Randy.