Mail Archives: djgpp/1998/09/26/12:00:45
Eneko Lacunza <enlar AT hidespam DOT iname DOT com> wrote:
: Hello All!
: I'm having some problems with the following code:
: === Cut ===
: #define pi 3.1415926535897932385
: void build_table(void)
: {
: unsigned short xcont,ycont;
: float radio,angulo;
: for(ycont=0;ycont<200;ycont++)
: for(xcont=0;xcont<320;xcont++)
: {
: radio=sqrt((xcont-160)*(xcont-160)+(100-ycont)*(100-ycont));
: angulo=atan2((xcont-160),(100-ycont));
: table[xcont][ycont][0]=floor(radio);
: table[xcont][ycont][1]=floor(255*angulo/(2*pi)); // FPE
: }
: }
: === Cut ===
: This crashes at the point noted as //FPE with a Floating Point
: exception. This is quite tricky, because it doesn't crash in a shell (i.e.
: running it under rhide) and if I try to redir the crash, redir crashes when
: the program has finished the above code and is doing something else.
: Could somebody tell me what does that exception mean, and how could I
: fix it (if this info is enough). I'm using GCC 2.7.2...
: Any help would be appreciated.
If you're sure you have correct code, than this my help:
use:
#include <float.h>
and call _fpcontrol(MSW_EM,MSW_EM) at the beggining of main().
This will disable FPEs.
--
<smikecin AT bigfoot DOT com>
- Raw text -