comp.lang.ada
 help / color / mirror / Atom feed
From: "Anders Wirzenius" <anders.wirzenius@pp.qnet.fi>
Subject: Re: GNAT Ada.Numerics.Aux question
Date: Tue, 29 Jul 2003 05:06:53 GMT
Date: 2003-07-29T05:06:53+00:00	[thread overview]
Message-ID: <NhnVa.11$zM1.7@read3.inet.fi> (raw)
In-Reply-To: ed66a020.0307281917.333e3587@posting.google.com

"Happy Segfault" <happysegfault@yahoo.com> wrote in message
news:ed66a020.0307281917.333e3587@posting.google.com...
> Hi all!
>
> I'm trying out GtkAda 2.2.0 on my Red Hat 9 system using gcc 3.2.2,
> and the testgtk OpenGL demo crashes with a constraint error.  I
think
> I've tracked down the problem to a call to Ada.Numerics.Aux.Sin,
which
> is a thin binding to the libm sin function.  What could be going
wrong
> here?  Why isn't Sin (X) getting the expected value in the program
> below?  Oddly, Sqrt (X) seems to work fine.
>
> --
> -- test_sin.adb
> --
> with Ada.Text_IO;
> with Ada.Numerics.Aux;
>
> procedure test_sin is
>   X : Ada.Numerics.Aux.Double;
> begin
>   X := Ada.Numerics.Aux.Double (2.0);
>   X := Ada.Numerics.Aux.Sqrt (X);
>   Ada.Text_IO.Put_Line (Ada.Numerics.Aux.Double'Image (X));
>   -- output is ' 1.41421356237309505E+00' which is expected
>   X := Ada.Numerics.Aux.Double (30.0 * 3.14159 / 180.0);
>   X := Ada.Numerics.Aux.Sin (X);
>   -- use the pragma Import (C, Sin, "sin"); from Ada.Numerics.Aux
>   Ada.Text_IO.Put_Line (Ada.Numerics.Aux.Double'Image (X));
>   -- output is '0.E+17' but 0.5 is the expected result
>   Ada.Text_IO.Put_Line (Float'Image (Float (X)));
>   -- raises constraint error
> end test_sin;
>
> Thanks!
>
> John

Works on Windows XP, Gnat 3.15p:

---------- Run the executable ----------
 1.41421356237309505E+00
 4.99999616987255739E-01
 5.00000E-01
Normal Termination
Output completed (0 sec consumed).

Anders




  reply	other threads:[~2003-07-29  5:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-29  3:17 GNAT Ada.Numerics.Aux question Happy Segfault
2003-07-29  5:06 ` Anders Wirzenius [this message]
2003-07-29  5:17 ` arvids lemchens
2003-07-29  8:34   ` Preben Randhol
2003-07-29  8:37 ` Preben Randhol
2003-07-29 12:37   ` Happy Segfault
2003-07-29 12:51     ` Preben Randhol
2003-07-29 20:01 ` Gerald
replies disabled

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