From: Gerald.Kasner@Physik.Uni-Magdeburg.de (Gerald)
Subject: Re: GNAT Ada.Numerics.Aux question
Date: 29 Jul 2003 13:01:48 -0700
Date: 2003-07-29T20:01:48+00:00 [thread overview]
Message-ID: <79567951.0307291201.7f74ef18@posting.google.com> (raw)
In-Reply-To: ed66a020.0307281917.333e3587@posting.google.com
happysegfault@yahoo.com (Happy Segfault) 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
You may use gcc-gnat from redhat-rawhide.
Here is what I got on a RH 9.0 system with gcc-gnat from
redhat-rawhide:
gnatmake -O2 test_sin.adb
gcc -c -O2 test_sin.adb
test_sin.adb:2:18: warning: "ada.numerics.aux" is an internal GNAT
unit
test_sin.adb:2:18: warning: use of this unit is non-portable and
version-dependent
gnatbind -x test_sin.ali
gnatlink test_sin.ali
./test_sin
1.41421356237309505E+00
4.99999616987255739E-01
5.00000E-01
gnatmake -v
GNATMAKE 3.3 20030715 (Red Hat Linux 3.3-14) Copyright 1995-2002 Free
Software Foundation, Inc.
..
you have to install a new binutils package from rawhide too.
Best, Gerald
prev parent reply other threads:[~2003-07-29 20:01 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
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 [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