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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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!news3.google.com!feeder.news-service.com!weretis.net!feeder2.news.weretis.net!feeder.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Colin Paul Gloster 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: Wed, 24 Feb 2010 10:07:40 +0000 Organization: A noiseless patient Spider Message-ID: References: Reply-To: Colin Paul Gloster Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Injection-Date: Wed, 24 Feb 2010 10:10:24 +0000 (UTC) Injection-Info: news.motzarella.org; posting-host="kheEuXGHhE2Z5eF1gAST+A"; logging-data="15552"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+/hgu0MnI4uGbpPhPrlENiPmLcIbIaevDoKtVcyG3ngg==" User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) In-Reply-To: Cancel-Lock: sha1:UMvch23aiu1cKe2EC3MlsmhKDqw= X-X-Sender: Colin_Paul@Bluewhite64.example.net Xref: g2news1.google.com comp.lang.ada:9300 Date: 2010-02-24T10:07:40+00:00 List-Id: On Tue, 16 Feb 2010, Colin Paul Gloster alleged: |------------------------------------------------------------------------------------------------------------------------| |"[..] | | | |with Ada.Numerics.Generic_Elementary_Functions; | |with Interfaces.C; | |with Ada.Text_IO; | |procedure Logarithmic_Work_In_Ada_with_a_Findlay_loop_with_a_Parker_GNATism is | | Log_Base_10_Of_The_Base_Of_The_Natural_Logarithm : constant | |Interfaces.C.Double := 0.434_294_481_903_251_827_651_129; | | | | answer : Interfaces.C.double := 0.0; | | package double_library is new | |Ada.Numerics.Generic_Elementary_Functions(Interfaces.C.double); | | package double_output_library is new | |Ada.Text_IO.Float_IO(Interfaces.C.double); | |begin | | | | for I in 1 .. 1_000_000 loop | | for J in 1 .. 500 loop | | answer := Interfaces.C."+" | | ( | | answer, Interfaces.C."*" | | ( | | double_library.Log | | ( | | Interfaces.C."*" | | ( | | Interfaces.C.double(J),| | 0.100000000000000000000| | ) | | ) | | , | | Log_Base_10_Of_The_Base_Of_The_Natural_Logarithm | | ) | | ); | | end loop; | | end loop; | | | | double_output_library.Put(answer); | |end; | | | |[..]" | |------------------------------------------------------------------------------------------------------------------------| Actually this is not a GNATism. I have noticed that "*"(Left=>variable, Right=>Log_Base_10_Of_The_Base_Of_The_Natural_Logarithm) is faster than log(X=>variable, Base=>10.0) on a number of other compilers.