comp.lang.ada
 help / color / mirror / Atom feed
* Maths LIb
@ 1997-10-18  0:00 DRD Woodward
  1997-10-18  0:00 ` Simon Wright
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: DRD Woodward @ 1997-10-18  0:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 896 bytes --]


Hello World !
I'm using !!@*&^ AvtivAda ^^&%�!!? and having severe problems.
It tells me that the package I require, (GENERIC_ELEMENTARY_FUNCTIONS),
 is already compiled,and all I need do is use the a global  'With' clause,
then Instantiate it.( $%�&)
It compiles ok. but 'bind' says package (GENERIC_ELEMENTARY_FUNCTIONS)
not compiled.
Another example of how reading and following clear instructions is a load of
bollocks.Who writes this crap.Who has the nerve to sell it.!!
Any way as I,m tied into using Ada and for now this heap of Binary Dross
(deadline in eight days.... and counting....) I wonder if one of you kind
people out there might have an appropriate maths package (Spec+Body) that
contains at least the Tanh function and are happy to wing it down the wires
to me as soon as possible.

ANSI/MIL-STD-1815A-1983
Thanks in advance..........Duncan
doig@mwangi.demon.co.uk









^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Maths LIb
  1997-10-18  0:00 ` Simon Wright
@ 1997-10-18  0:00   ` Keith Thompson
  0 siblings, 0 replies; 5+ messages in thread
From: Keith Thompson @ 1997-10-18  0:00 UTC (permalink / raw)



Simon Wright (simon@pogner.demon.co.uk) wrote:
> "DRD Woodward" <doig@mwangi.demon.co.uk> writes:
> 
> > I'm using ... AvtivAda ... and having severe problems.
[...]
> > It tells me that the package I require, (GENERIC_ELEMENTARY_FUNCTIONS),
> >  is already compiled,and all I need do is use the a global  'With' clause,
> > then Instantiate it.
[..]
> It's called Ada.Numerics.Generic_Elementary_Functions -- see example:
> 
> with Ada.Text_Io;
> with Ada.Float_Text_Io;
> with Ada.Numerics.Generic_Elementary_Functions;
> procedure Math is
>   package Funcs is new Ada.Numerics.Generic_Elementary_Functions (Float);
>   X : Float := 0.5;
>   Y : Float;
> begin
>   Y := Funcs.Tanh (X);
>   Ada.Text_Io.Put ("tanh(0.5) is");
>   Ada.Float_Text_Io.Put (Y);
>   Ada.Text_Io.New_Line;
> end Math;
> 
> Output is "tanh(0.5) is 4.62117E-01", is that OK?
> 
> > ANSI/MIL-STD-1815A-1983
> 
> Of course, if you're using Ada83 this particular solution won't help
> you -- but then, you said you're using ActiveAda --

I believe ActivAda is an Ada 83 compiler; ObjectAda is the Ada 95
successor.  If you weren't short of time, I'd suggest upgrading.

I don't currently have access to ActivAda, but the example should
probably be something like this:

with Text_Io;
with Generic_Elementary_Functions;
procedure Math is
  package Float_Text_Io is new Text_IO.Float_IO(Float);
  package Funcs is new Generic_Elementary_Functions (Float);
  X : Float := 0.5;
  Y : Float;
begin
  Y := Funcs.Tanh (X);
  Text_Io.Put ("tanh(0.5) is");
  Float_Text_Io.Put (Y);
  Text_Io.New_Line;
end Math;

Note that ActivAda's library management scheme is a bit more complicated
than that of most Ada 95 compilers.  Read the manual carefully for
instructions on making Generic_Elementary_Functions visible and available
to your program.

If that still doesn't work, post the *exact* error message you get when
you try to build the above example program.  (If I got something wrong,
fix whatever bugs you can and re-post the example.)  I'm sure someone
familiar with ActivAda will then be able to help you.

If all else fails, you might try using the tanh() function from the C
math library.  Remember that the C declaration of tanh() is

    double tanh(double x);

C's type double typically corresponds to Ada's Long_Float, not Float.
In Ada 95, the declaration would be

    function tanh(X: Interfaces.C.Double) return Interfaces.C.Double;
    pragma Import(C, tanh, "tanh");

For ActivAda, you'll need to use the Ada 83 pragma Interface and/or
some implementation-defined pragma(s).  You may also need to give
extra arguments to the linker so it can find the math library.  See the
documentation for details.

"DRD Woodward" <doig@mwangi.demon.co.uk> also wrote:
> Another example of how reading and following clear instructions is a load of
> bollocks.Who writes this crap.Who has the nerve to sell it.!!

That would be the people who are most willing and able to help you with
your problem, and whom you've just insulted when you most desperately
need their assistance.

Have a nice day.

-- 
Keith Thompson (The_Other_Keith) kst@cts.com <*>
^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H
San Diego, California, USA
"Simba, you have forgotten me.  I am your father.  This is CNN." -- JEJ




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Maths LIb
  1997-10-18  0:00 Maths LIb DRD Woodward
@ 1997-10-18  0:00 ` Simon Wright
  1997-10-18  0:00   ` Keith Thompson
  1997-10-19  0:00 ` Tom Moran
  1997-10-23  0:00 ` Marc Bejerano
  2 siblings, 1 reply; 5+ messages in thread
From: Simon Wright @ 1997-10-18  0:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1736 bytes --]


"DRD Woodward" <doig@mwangi.demon.co.uk> writes:

> I'm using !!@*&^ AvtivAda ^^&%�!!? and having severe problems.

I use GNAT.

> It tells me that the package I require, (GENERIC_ELEMENTARY_FUNCTIONS),
>  is already compiled,and all I need do is use the a global  'With' clause,
> then Instantiate it.( $%�&)

This sounds (pardon me if I'm wrong) as though you aren't very familiar
with Ada?

> It compiles ok. but 'bind' says package (GENERIC_ELEMENTARY_FUNCTIONS)
> not compiled.

Perhaps if you gave us a source example we would be better able to help.

> Any way as I,m tied into using Ada and for now this heap of Binary Dross
> (deadline in eight days.... and counting....) I wonder if one of you kind
> people out there might have an appropriate maths package (Spec+Body) that
> contains at least the Tanh function and are happy to wing it down the wires
> to me as soon as possible.

It's called Ada.Numerics.Generic_Elementary_Functions -- see example:

with Ada.Text_Io;
with Ada.Float_Text_Io;
with Ada.Numerics.Generic_Elementary_Functions;
procedure Math is
  package Funcs is new Ada.Numerics.Generic_Elementary_Functions (Float);
  X : Float := 0.5;
  Y : Float;
begin
  Y := Funcs.Tanh (X);
  Ada.Text_Io.Put ("tanh(0.5) is");
  Ada.Float_Text_Io.Put (Y);
  Ada.Text_Io.New_Line;
end Math;

Output is "tanh(0.5) is 4.62117E-01", is that OK?

> ANSI/MIL-STD-1815A-1983

Of course, if you're using Ada83 this particular solution won't help
you -- but then, you said you're using ActiveAda --

-- 
Simon Wright                        Work Email: simon.j.wright@gecm.com
GEC-Marconi Radar & Defence Systems            Voice: +44(0)1705-701778
Command & Information Systems Divsion            FAX: +44(0)1705-701800




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Maths LIb
  1997-10-18  0:00 Maths LIb DRD Woodward
  1997-10-18  0:00 ` Simon Wright
@ 1997-10-19  0:00 ` Tom Moran
  1997-10-23  0:00 ` Marc Bejerano
  2 siblings, 0 replies; 5+ messages in thread
From: Tom Moran @ 1997-10-19  0:00 UTC (permalink / raw)



Check with Aonix support (if nobody gives you an answer here).  I
recall you have to set library links some way to get the math library,
which is indeed included with ActivAda.  Sorry I don't remember what
to do - it's been a while.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Maths LIb
  1997-10-18  0:00 Maths LIb DRD Woodward
  1997-10-18  0:00 ` Simon Wright
  1997-10-19  0:00 ` Tom Moran
@ 1997-10-23  0:00 ` Marc Bejerano
  2 siblings, 0 replies; 5+ messages in thread
From: Marc Bejerano @ 1997-10-23  0:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 862 bytes --]


In article <877175772.10098.0.nnrp-08.9e988f8e@news.demon.co.uk>,
	"DRD Woodward" <doig@mwangi.demon.co.uk> writes:
>Hello World !
>I'm using !!@*&^ AvtivAda ^^&%�!!? and having severe problems.
>It tells me that the package I require, (GENERIC_ELEMENTARY_FUNCTIONS),
> is already compiled,and all I need do is use the a global  'With' clause,
>then Instantiate it.( $%�&)
>It compiles ok. but 'bind' says package (GENERIC_ELEMENTARY_FUNCTIONS)
>not compiled.

Have you tried instantiating it as a generic should be? For example,

	with Generic_Elementary_Functions;

	.
	.
	.

	package Float_Stuff is new Generic_Elementary_Functions (Float);
	use Float_Stuff;

	.
	.
	.

	If you've tried that already (which I use with Alsys Ada 5.x) and it still
	doesn't work, I hope somebody sends you the Tanh function you need.

	Hope this helps,

	Marc Bejerano





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1997-10-23  0:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-10-18  0:00 Maths LIb DRD Woodward
1997-10-18  0:00 ` Simon Wright
1997-10-18  0:00   ` Keith Thompson
1997-10-19  0:00 ` Tom Moran
1997-10-23  0:00 ` Marc Bejerano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox