From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 5180 invoked from network); 18 Feb 1999 20:16:21 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 18 Feb 1999 20:16:21 -0000 Received: from paralleldata.com (smtp.paralleldata.com [38.153.145.2]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id PAA21247 for ; Thu, 18 Feb 1999 15:02:14 -0500 Received: by paralleldata.com from localhost (router,SLMail V2.5); Thu, 18 Feb 1999 14:05:09 -0600 Received: by paralleldata.com from paralleldata.com (207.158.98.234::mail daemon; unverified,SLMail V2.5); Thu, 18 Feb 1999 14:05:03 -0600 Sender: "Wsb" Message-ID: <36CC7F91.3B49F7BC@paralleldata.com> Date: Thu, 18 Feb 1999 21:01:05 +0000 From: "Wes Bauske" Organization: Parallel Data Systems X-Mailer: Mozilla 4.04 [en] (X11; U; Linux 2.0.33 i686) MIME-Version: 1.0 To: axp-list@redhat.com Subject: Re: OffTopic: PovRay3 for AlphaLinux ? References: <19990218114843.A865@czerny.toppoint.de> <36CC3842.1456962C@tn.utwente.nl> <19990218124753.R16253@csee.wvu.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Daniel J. Frasnelli wrote: > > > I'd suggest to check carefully that the code is never doing anything > > wrong with "subnormalized" numbers. I found that -mieee option is > > useless with my compiler and whenever my numbers are around > > ...e-310 I'm getting Floating point exception. > Andrei, > I am working with Curtis Olson (lead developer, FlightGear flight > simulator(FGFS) ) on a similar problem. Both he and > I are beginning to suspect bugs in the AXP port of egcs. For example, > part of the graphics initialization routines in FGFS set up coordinates for > a 640x480 window. As you might have read already, FGFS crashes with a > fpe upon startup. Going through the code stepwise and watching the > variable values, there is a point where the following happens: > > 1) Some of the coordinates are set to a number of order e-310 (obviously wrong) This looks like the real bug. Most likely a pointer is screwed up or you're using an uninitialized variable of some sort. > 2) An integer divide is called which approximates the coordinates to 0. > 3) The result becomes a number x/0, which causes the fpe. > Why is the code expecting a divide by zero to be valid?? > I am not sure where to start when debugging the problem, but it definately > seems to be compiler-related; programs like xlockmore's "flow" mode and > most GL modes, several graphical demos shipped with glut, and others > crash from similar conditions. One might look through a debug of these > programs and point at Mesa or the Glut toolkit (many fpe occur during a > light position calculation). I personally think this is a domino-like > effect where a bug in egcs causes strange and terrible miscalculations > with math operations in all software compiled by it. > It does not seem to be an endian-ness or 64-bit problem, as I can > build FGFS under Irix (yes, using -64 and -mips4) and not have the same > problems. > > Any thoughts? There are certain things you need to understand when you push the edges of FP representation. Linux Alpha in particular can run into problems with "denormals". It has been discussed several times on this list. The end result is either try -mieee or, alter the code so that it detects very small numbers in those places where they can have bad effects on your calculation. As an example, I just modified some code because some less than bright programmer decided it made sense to do a FP "if(value1 == value2)". On many systems, the Alpha included, it is difficult to ever attain identical FP values, unless they are input values to the program. The proper way to code such a test is to take the fabs(value1-value2) and see if it is smaller than some algorithm dependent NOISE value, along the lines of 1e-10 or so for the case I fixed. There are other types of issues too. All you do is modify the code to work on any system, not just the one you built it on, realizing that when you expect to generate small values, you need to be careful how you code things. I've run into this stuff many times and it is almost always straight forward to fix. One other thing, I believe you have to turn on FP emulation in the kernel if you use -mieee so the kernel can do the fix up for the FPE. Wes