Mail Archives: djgpp/1998/09/25/07:45:54
Eneko Lacunza <enlar AT hidespam DOT iname DOT com> wrote:
> 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));
atan2(0,0) might be handled not quite right, so that
> table[xcont][ycont][0]=floor(radio);
> table[xcont][ycont][1]=floor(255*angulo/(2*pi)); // FPE
floor crashes.
> }
> }
> 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.
In a dos-box under windows 95, you can mark the screen and paste in a
text-file, maybe that helps.
> Could somebody tell me what does that exception mean, and how could I
Perhaps devide by zero.
> fix it (if this info is enough). I'm using GCC 2.7.2...
Do you compile with -lm, or do you use the standards in libc? libm
does some more checking (if I've understood correctly)
What type of computer do you use? (386/486/pentiumII?)
hth,
Robert.
--
rjvdboon AT cs DOT vu DOT nl | "En dat is niet waar!" sprak ex-Staatsecretaris-
www.cs.vu.nl/~rjvdboon | van-Onderwijs Netelenbos fel.
- Raw text -