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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,a9b55bb56f6172ed X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-24 00:50:05 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: jsuarezrivaya@yahoo.es (Jorge Su?rez-Sol?s Rivaya) Newsgroups: comp.lang.ada Subject: Re: problems with log function Date: 24 Dec 2003 00:50:04 -0800 Organization: http://groups.google.com Message-ID: <61f665c0.0312240050.1c881f6c@posting.google.com> References: <61f665c0.0312230412.6086c787@posting.google.com> NNTP-Posting-Host: 213.141.58.34 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1072255805 13709 127.0.0.1 (24 Dec 2003 08:50:05 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 24 Dec 2003 08:50:05 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:3776 Date: 2003-12-24T00:50:04-08:00 List-Id: Thank you very much, you are rigth, I have tried the programa on another platform and it works, ... I was using the compiler version which comes with Mandrake 9.1. Anyway it works, thank you again. Jorge ------------------------------------------------------------------------------ Stephen Leake wrote in message news:... > 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.