comp.lang.ada
 help / color / mirror / Atom feed
From: jsuarezrivaya@yahoo.es (Jorge Su?rez-Sol?s Rivaya)
Subject: Re: problems with log function
Date: 24 Dec 2003 00:50:04 -0800
Date: 2003-12-24T00:50:04-08:00	[thread overview]
Message-ID: <61f665c0.0312240050.1c881f6c@posting.google.com> (raw)
In-Reply-To: mailman.174.1072200377.31149.comp.lang.ada@ada-france.org

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 <Stephe.Leake@nasa.gov> wrote in message news:<mailman.174.1072200377.31149.comp.lang.ada@ada-france.org>...
> 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.



      reply	other threads:[~2003-12-24  8:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-23 12:12 problems with log function Jorge Su?rez-Sol?s Rivaya
2003-12-23 17:26 ` Stephen Leake
2003-12-24  8:50   ` Jorge Su?rez-Sol?s Rivaya [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