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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a9b55bb56f6172ed X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-23 09:27:07 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed.stueberl.de!proxad.net!usenet-fr.net!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: problems with log function Date: 23 Dec 2003 12:26:06 -0500 Organization: Cuivre, Argent, Or Message-ID: References: <61f665c0.0312230412.6086c787@posting.google.com> NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: melchior.cuivre.fr.eu.org 1072200377 42407 80.67.180.195 (23 Dec 2003 17:26:17 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Tue, 23 Dec 2003 17:26:17 +0000 (UTC) To: comp.lang.ada@ada-france.org Return-Path: In-Reply-To: <61f665c0.0312230412.6086c787@posting.google.com> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 X-Virus-Scanned: by amavisd-new-20030616-p5 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.3 Precedence: list List-Id: Gateway to the comp.lang.ada Usenet newsgroup List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: archiver1.google.com comp.lang.ada:3762 Date: 2003-12-23T12:26:06-05:00 jsuarezrivaya@yahoo.es (Jorge Su?rez-Sol?s Rivaya) writes: > hi, this is my first post. Welcome! > > First of all 'hi' to every body, my name is Jorge and Im from Spain. > > I have a problem with the log function. > > I have made an instantion of the generic package > Ada.Numerics.Generic_Elementary_Function for Floats something like > this: > > package Math is new Ada.Numerics.Generic_Elementary_Function(Float); > use Math; > > and when i use it a say: log(Y) > Y is a float of course. I do not have any compilation problem, but > when I execute it I get an Ada.Numerics.Argument_Error if Y is higher > than 1.0 It helps if you post a compilable example to show your problem. Often the problem is not what you think it is; having the real source lets us see what is really going on for you. Since this is your first post, and I'm on lunch break, I wrote one for you: with Ada.Numerics.Generic_Elementary_Functions; with Ada.Text_Io; use Ada.Text_Io; procedure Jorge is package Math is new Ada.Numerics.Generic_Elementary_Functions (Float); use Math; X : Float; begin Put_Line ("x log (x)"); for Y in 1 .. 10 loop X := 0.2 * Float (Y); Put_Line (Float'Image (X) & " " & Float'Image (Log (X))); end loop; end Jorge; Compiling and running this with GNAT 5.01a on Windows 2000, I get: make -r jorge.run gnatmake -k -O3 -gnatn -gnatwa -I.. jorge -largs -bargs -cargs gcc -c -I./ -O3 -gnatn -gnatwa -I.. -I- ..\jorge.adb gnatbind -aO./ -I.. -I- -x jorge.ali gnatlink jorge.ali ./jorge.exe x log (x) 2.00000E-01 -1.60944E+00 4.00000E-01 -9.16291E-01 6.00000E-01 -5.10826E-01 8.00000E-01 -2.23144E-01 1.00000E+00 0.00000E+00 1.20000E+00 1.82322E-01 1.40000E+00 3.36472E-01 1.60000E+00 4.70004E-01 1.80000E+00 5.87787E-01 2.00000E+00 6.93147E-01 I didn't check the numbers, but I assume they are correct. In any case, no constraint errors. It may be that log is actually broken on your platform; please tell us what compiler and operating system you are using. Hope this helps. -- -- Stephe