From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 32205 invoked from network); 4 May 1998 17:31:22 -0000 Received: from smtp.paralleldata.com (HELO paralleldata.com) (38.153.145.2) by mail2.redhat.com with SMTP; 4 May 1998 17:31:22 -0000 Received: by paralleldata.com from localhost (router,SLMail V2.5); Mon, 04 May 1998 12:31:28 -0500 Received: by paralleldata.com from paralleldata.com (153.35.190.243::mail daemon; unverified,SLMail V2.5); Mon, 04 May 1998 12:31:26 -0500 Sender: "Wsb" Message-ID: <354DFD0E.23A0E43A@paralleldata.com> Date: Mon, 04 May 1998 12:38:23 -0500 From: "Wes Bauske" Organization: PDS Inc. X-Mailer: Mozilla 4.04 [en] (X11; U; Linux 2.0.31 i686) MIME-Version: 1.0 To: "axp-list@redhat.com" Subject: Re: floating point exceptions: Linux kernel feature or bug? References: <199805041645.LAA02957@bifur.math.ukans.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Aaron M. Johnson wrote: > Hi, > > Your message about the floating point exception sounds related > to a problem I have. For me it appears to be an underflow. Keep me > posted if you find a solution. > > Thank you, > aaron > > I am running Persistance of Vision ray tracer (povray) compiled on > > [amj@testnode branch]$ uname -a > Linux testnode.math.ukans.edu 2.1.96 #2 SMP Thu Apr 16 19:05:54 CDT 1998 alpha unknown > [amj@testnode branch]$ gcc --version > 2.7.2.3 > > This code generates a picture as output using Intel-Linux and IRIX 6.3 > > [amj@testnode branch]$ gdb ~/bin/povray.debug > (gdb) run +L/home/amj/thesis/povray3/include +Imov +KFF1 +FP > Starting program: /home/amj/bin/povray.debug +L/home/amj/thesis/povray3/include +Imov +KFF1 +FP > > > > Parsing........... > > Creating bounding slabs. > Scene contains 1 frame level objects; 0 infinite. > > 00:00:00 so far, Rendering frame 1, going to 1. > > Rendering... > Program received signal SIGFPE, Arithmetic exception. > > 0x120045dcc in do_specular (Finish=0x120211ce0, Light_Source_Ray=0x11fffec38, > REye=0x11ffff5d8, Layer_Normal=0x11ffff6e0, Colour=0x11ffff758, > Light_Colour=0x11ffff5f0, Layer_Pigment_Colour=0x11ffff710) > at ../lighting.c:1688 > 1688 Intensity = Finish->Specular * pow(Cos_Angle_Of_Incidence, Finish->Roughness); > (gdb) list 1680 > 1675 > 1676 VHalf(Halfway, REye, Light_Source_Ray->Direction); > 1677 > 1678 VLength(Halfway_Length, Halfway); > 1679 > 1680 if (Halfway_Length > 0.0) > 1681 { > 1682 VDot(Cos_Angle_Of_Incidence, Halfway, Layer_Normal); > 1683 > 1684 Cos_Angle_Of_Incidence /= Halfway_Length; > (gdb) > 1685 > 1686 if (Cos_Angle_Of_Incidence > 0.0) > 1687 { > 1688 Intensity = Finish->Specular * pow(Cos_Angle_Of_Incidence, Finish->Roughness); > 1689 > 1690 if (Finish->Metallic > 0.0) > 1691 { > 1692 /* > 1693 * Calculate the reflected color by interpolating between > 1694 * the light source color and the surface color according > (gdb) p Halfway_Length > $1 = 0.7136288436493563 > (gdb) p Cos_Angle_Of_Incidence > $2 = 0.49138409073828376 > (gdb) p Intensity > $3 = 2.3872427115046736e-314 > (gdb) > > Don't know the gdb syntax to print values within structure Finish-> Use "p *structptrname" or just 'p structname". Be careful about assuming there is no bug in the code. What you show here is similar to what I found in my own code when I first ported it to Alpha. It looks like an underflow but the cause could be more than one thing. For example, somehow pointers get screwed up and you attempt to use a int when it was supposed to be a float. Course it could also be a true underflow. Recursive agorithms can easily underflow. Choices are to build using the ieee flags or figure out how to silently handle the underflows. A while back, someone talked about setting FP modes on the Alpha processor. I started to look at it but found it was easier to debug my code, plus the code is now correct vs previously using garbage as valid data. Wes