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-Thread: 103376,1e11857ea4f39dd6 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Newsgroups: comp.lang.ada Subject: Re: Trig Function Linking Problems References: <1176755562.190964.167640@w1g2000hsg.googlegroups.com> From: Markus E Leypold Organization: N/A Date: Tue, 17 Apr 2007 01:39:57 +0200 Message-ID: <20ejmjj3ci.fsf@hod.lan.m-e-leypold.de> User-Agent: Some cool user agent (SCUG) Cancel-Lock: sha1:K6YPrU037gBYpu+okoHUF8Y9Mjo= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: 88.72.208.73 X-Trace: news.arcor-ip.de 1176766342 88.72.208.73 (17 Apr 2007 01:32:22 +0200) X-Complaints-To: abuse@arcor-ip.de Path: g2news1.google.com!news3.google.com!feeder3.cambrium.nl!feeder5.cambrium.nl!feed.tweaknews.nl!68.142.88.75.MISMATCH!hwmnpeer01.ams!news.highwinds-media.com!kramikske.telenet-ops.be!nntp.telenet.be!news.skynet.be!feeder.news-service.com!194.25.134.62.MISMATCH!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor-ip.de!news.arcor-ip.de!not-for-mail Xref: g2news1.google.com comp.lang.ada:15072 Date: 2007-04-17T01:39:57+02:00 List-Id: Jeffrey Creem writes: > AJAskey wrote: >> Hi. We are moving some software from and ancient workstation to a >> newer one. The environment is still several years old but newer than >> the old-timer we are leaving. We cannot get the TRIG functions to >> work as there appears to be a problem interfacing to the library. The >> following test code works on the old-time system, but fails on two >> separate newer systems. Any help would be greatly appreciated. >> with ada.text_io; >> use ada.text_io; >> with ada.numerics.elementary_functions; >> procedure TRIG is >> a,b,c,d : float; >> begin >> a := 3.1415/4.0; >> b := ada.numerics.elementary_functions.sin(x=>a); >> c := ada.numerics.elementary_functions.cos(x=>a); >> d := ada.numerics.elementary_functions.tan(x=>a); >> put_line("sin(a)" & float'image(b)); >> put_line("cos(a)" & float'image(c)); >> put_line("tan(a)" & float'image(d)); >> put_line("a " & float'image(a)); >> end TRIG; >> >>>>From system with : GNATMAKE 3.13p (20000509) Copyright 1995-2000 >> Free Software Foundation, Inc. >> gcc 2.96 >> Linux Red Hat 7.1 2.96-98 >> [I don't need to do anything special except a gnatmake.] >> >>>> gnatmake trig >> gnatgcc -c trig.adb >> gnatbind -x trig.ali >> gnatlink trig.ali >> >>>> trig >> sin(a) 7.07090E-01 >> cos(a) 7.07123E-01 >> tan(a) 9.99954E-01 >> a 7.85375E-01 >> --------------------------------------------- >> >>>>From new system with : GNATMAKE 3.2.3-13 (20030502) Copyright >> 1995-2000 Free Software Foundation, Inc. >> gcc 3.2.3 >> Linux Red Hat 3.2.3-53 >> >>>> gnatmake trig >> gcc -c trig.adb >> gnatbind -x trig.ali >> gnatlink trig.ali >> >>>> trig >> raised CONSTRAINT_ERROR : s-imgrea.adb:236 >> [I tried linking in the -lm library which is required in the "c" >> version of this test. I also tried linking a few others, but >> continued to get the run-time error. >> On another similar system, the program ran but returned NaN in the >> debugger for b,c,d after the sin,cos,tan calls. I assume it really >> isn't finding the library.] >> >>>> gnatmake -c trig.adb >>>> gnatbind -x trig >>>> gnatlink -lm -lc -lgnat trig >> >>>> trig >> raised CONSTRAINT_ERROR : s-imgrea.adb:236 >> Any ideas what I should be linking in? >> Thanks much. >> Andy >> > > I don't think the problem is not finding the library as this generally > gives a much more specific error. I would guess it is more > fundamentally broken than just a library issue. > > Can you update to a GNATPro version or a later GCC version? It seems to be some strange hardware (compatibility?) problem. The file in question has the following comment: -- The following exception is only raised in case of erroneous -- execution, where a number was considered valid but still -- fails to scale up. One situation where this can happen is -- when a system which is supposed to be IEEE-compliant, but -- has been reconfigured to flush denormals to zero. if Scale < -Maxscaling then raise Constraint_Error; end if; I admit I don't know completely what the means, but suggest to have a look into the library and work from there. Regards -- Markus