comp.lang.ada
 help / color / mirror / Atom feed
* Problem with pragmas
@ 1999-06-30  0:00 Robert Schien
  1999-06-30  0:00 ` Florian Weimer
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Robert Schien @ 1999-06-30  0:00 UTC (permalink / raw)


I need to access the erf (Gaussian error function) from the C-Math-Library.
But the following program does not work correctly:


 with Ada.Float_Text_IO;
 use  Ada.Float_Text_IO;
 with Ada.Text_IO;
 use  Ada.Text_IO;
 with Interfaces.C;
 use  Interfaces.C;

 procedure pragtest is      

 y: float;
 c_y: C_float;

-- Accessing Gaussian error function
function erf (x: in C_float) return C_float;
   pragma Import(C,erf);

begin
y:=0.3;
c_y:=c_float(y);
c_y:=erf(c_y);
y:=float(c_y);
put(y);
 end pragtest;

This program is compiled and linked with the command
gnatmake pragtest.adb -largs -lm

But when I execute pragtest, the printed result is always 0.0.
(The correct result is something between 0 and 1, in this case
about 0.32)

What did I miss?

The platform is FreeBSD-4.0-current (x86) with GNAT 3.11p.

TIA
Robert




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

end of thread, other threads:[~1999-07-01  0:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-30  0:00 Problem with pragmas Robert Schien
1999-06-30  0:00 ` Florian Weimer
1999-07-01  0:00   ` Robert Schien
1999-06-30  0:00 ` Robert I. Eachus
1999-06-30  0:00 ` David

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