comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
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
Date: 2010-02-15T17:20:01-06:00	[thread overview]
Message-ID: <hlckr3$70m$1@munin.nbi.dk> (raw)
In-Reply-To: alpine.LNX.2.00.1002151055530.17315@Bluewhite64.example.net

"Colin Paul Gloster" <Colin_Paul_Gloster@ACM.org> 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.





      parent reply	other threads:[~2010-02-15 23:20 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-15 10:58 Is there an Ada compiler whose Ada.Numerics.Generic_Elementary_Functions.Log(Base=>10, X=>variable) is efficient? Colin Paul Gloster
2010-02-15 13:02 ` John B. Matthews
2010-02-15 14:17   ` Colin Paul Gloster
2010-02-15 17:19     ` John B. Matthews
2010-02-15 14:54 ` jonathan
2010-02-15 15:04   ` jonathan
2010-02-15 19:50     ` sjw
2010-02-16 16:50       ` Colin Paul Gloster
2010-02-15 18:26 ` (see below)
2010-02-15 18:51   ` jonathan
2010-02-15 20:00   ` sjw
2010-02-15 21:17     ` jonathan
2010-02-16  0:09       ` jonathan
2010-02-16 17:33   ` Colin Paul Gloster
2010-02-24 10:07     ` Colin Paul Gloster
2010-02-15 23:04 ` Jeffrey R. Carter
2010-02-16 14:54   ` Colin Paul Gloster
2010-02-16 15:24     ` Colin Paul Gloster
2010-02-16 19:01     ` Jeffrey R. Carter
2010-02-17 10:25       ` Colin Paul Gloster
2010-02-15 23:20 ` Randy Brukardt [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox