From: jonathan <johnscpg@googlemail.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 06:54:56 -0800 (PST)
Date: 2010-02-15T06:54:56-08:00 [thread overview]
Message-ID: <7b3d1a4c-e61f-41c0-a35b-a9d13c6f4f67@j31g2000yqa.googlegroups.com> (raw)
In-Reply-To: alpine.LNX.2.00.1002151055530.17315@Bluewhite64.example.net
On Feb 15, 10:58 am, Colin Paul Gloster <Colin_Paul_Glos...@ACM.org>
wrote:
> Hello,
>
> 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....
Here is my own bench ... easier to play with:
with ada.numerics.generic_elementary_functions;
with text_io; use text_io;
procedure log_bench is
type Real is digits 15;
package Math is new ada.numerics.generic_elementary_functions
(Real);
use Math;
x, y : Real := 0.1;
-- might (or might not!) be faster to use:
-- log_base_10 (x) = log_base_10_of_e * log_base_e (x)
Log_base_10_of_e : constant := 0.434_294_481_903_251_827_651_129;
begin
for i in 1 .. 1_000_000 loop
x := x + Log_base_10_of_e * Log (y);
y := y + 0.0000000000001;
end loop;
put (Real'Image(x));
end log_bench;
gnatmake gnatnp -O2 -march=native log_bench.adb
next prev parent reply other threads:[~2010-02-15 14:54 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 [this message]
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
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox