SDL : flaoting point exception

Hi,

My game crashes from time to time
with floating point exception error/sdl-parachute.

I’m wondering what could be the reason for this
as my game does not use floating point math.

Can someone please help me to understand this?

Cheers
Gunnar

Hi,

My game crashes from time to time
with floating point exception error/sdl-parachute.

Turn off the parachute and run the program in a debugger to find out
where the error is occuring.

I’m wondering what could be the reason for this
as my game does not use floating point math.

Your game most likely uses SDL as well as a number of other libraries.
Many of those libraries do use floating point math. Also, even if you
are using C/C++ or another language where you declare each variable type
you may be getting some floating point from something as simple as a
misplaced “.” in a constant.

Since you do not control the math used by 100% of the code you use it is
quite possible for your program to get floating point errors even when
you try not to use floating point in your own code.

Can someone please help me to understand this?

With luck, I just did :slight_smile:

	Bob PendletonOn Tue, 2006-03-21 at 17:49 +0100, Gunnar von Boehn wrote:

Cheers
Gunnar


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


±-------------------------------------+

Check for division by zero. Even in integer math, it can cause SIGFPE.

– JoshOn 3/21/06, Gunnar von Boehn wrote:

Hi,

My game crashes from time to time
with floating point exception error/sdl-parachute.

I’m wondering what could be the reason for this
as my game does not use floating point math.

Can someone please help me to understand this?

Hi,

Joshua Oreman wrote:

My game crashes from time to time
with floating point exception error/sdl-parachute.

Check for division by zero. Even in integer math, it can cause SIGFPE.

Bingo ! That was the reason.
Many thanks for the hint.

Funnily the PowerPC on which I wrote the game first
did not care at all for division by zero.

Cheers
Gunnar

Gunnar von Boehn wrote:

Funnily the PowerPC on which I wrote the game first
did not care at all for division by zero.

Yes, that’s what PPCs do. They obey the principle “garbage in, garbage
out”, not “garbage in, crash” as x86s do.

(Sorry, couldn’t help. I’ve been to an Apple Universal Application
Workshop today, got my hands on a MacBook Pro for the first time, and
still haven’t got over the shock of seeing x86 assembly in the Xcode
debugger :wink: )

-Christian