From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,cf7bb651bfb9d65c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-29 13:01:49 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: Gerald.Kasner@Physik.Uni-Magdeburg.de (Gerald) Newsgroups: comp.lang.ada Subject: Re: GNAT Ada.Numerics.Aux question Date: 29 Jul 2003 13:01:48 -0700 Organization: http://groups.google.com/ Message-ID: <79567951.0307291201.7f74ef18@posting.google.com> References: NNTP-Posting-Host: 62.104.209.64 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1059508908 27928 127.0.0.1 (29 Jul 2003 20:01:48 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 29 Jul 2003 20:01:48 GMT Xref: archiver1.google.com comp.lang.ada:40964 Date: 2003-07-29T20:01:48+00:00 List-Id: happysegfault@yahoo.com (Happy Segfault) wrote in message news:... > 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