[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: floating point exceptions: Linux kernel feature or bug?
- From: "Wes Bauske" <wsb paralleldata com>
- To: "axp-list redhat com" <axp-list redhat com>
- Subject: Re: floating point exceptions: Linux kernel feature or bug?
- Date: Mon, 04 May 1998 12:38:23 -0500
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
>
> <irrelevant povray output deleted>
>
> 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
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[]