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-28 22:07:17 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!lnsnews.lns.cornell.edu!newsstand.cit.cornell.edu!ngpeer.news.aol.com!newsfeed1!bredband!fi.sn.net!newsfeed2.fi.sn.net!news-stoc.telia.net!news-stoa.telia.net!telia.net!nntp.inet.fi!central.inet.fi!inet.fi!read3.inet.fi.POSTED!53ab2750!not-for-mail From: "Anders Wirzenius" Newsgroups: comp.lang.ada References: Subject: Re: GNAT Ada.Numerics.Aux question MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Message-ID: Date: Tue, 29 Jul 2003 05:06:53 GMT NNTP-Posting-Host: 194.251.142.2 X-Complaints-To: abuse@inet.fi X-Trace: read3.inet.fi 1059455213 194.251.142.2 (Tue, 29 Jul 2003 08:06:53 EEST) NNTP-Posting-Date: Tue, 29 Jul 2003 08:06:53 EEST Organization: Sonera corp Internet services Xref: archiver1.google.com comp.lang.ada:40925 Date: 2003-07-29T05:06:53+00:00 List-Id: "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 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