comp.lang.ada
 help / color / mirror / Atom feed
From: brh@cray.com (Brian Hanson)
Subject: Using complex from interfaces.fortran.
Date: 22 Feb 95 16:40:08 CST
Date: 1995-02-22T16:40:08-06:00	[thread overview]
Message-ID: <1995Feb22.164009.16834@driftwood.cray.com> (raw)

I was looking at the package Interfaces.Fortran.  Suppose you want to work
with complex numbers.  There is a type defined in this package called Complex
and you can do all the normal stuff with it but suppose you wish to output a
complex number.  How to do it?

with Interfaces.Fortran; use Interfaces.fortran;
with ada.text_io.complex_io;
procedure test is
  package complex_io is new ada.text_io.complex_io
	(single_precision_complex_types);
  with complex_io;

  a, b, c: complex;

begin
  a := (1.7, 2.8);
  b := (9.5, 6.2);

  c := a * b + complex'(2.3, 0.0);
  put(c);
end;

My expectation is that the put not compile because it expects the type
single_precision_complex_types.complex and not the complex defined in 
fortran.

Is this true.  If so, does it not make using complex from package fortran
very awkward for io and functions like sin, cos which are also accessed
via a generic package with a package parameter?


-- Brian Hanson
-- brh@cray.com

ps. I attempted to try this with gnat 2.03 but got compile errors for
the package instantiation.  So I do not know if it is gnat that is wrong
or my program that is wrong.


-- 
----
-- Brian Hanson
-- brh@cray.com



             reply	other threads:[~1995-02-22 22:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-02-22 22:40 Brian Hanson [this message]
1995-02-28 22:21 ` Using complex from interfaces.fortran Tucker Taft
replies disabled

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