From: "S. Mikecin" Newsgroups: comp.os.msdos.djgpp Subject: Re: Help - Floating Point Exception Date: 26 Sep 1998 15:36:14 GMT Organization: FER, Croatia Lines: 48 Message-ID: <6uj1le$4dg$7@bagan.srce.hr> References: Reply-To: sime AT fly DOT cc DOT etf DOT hr NNTP-Posting-Host: fly.cc.etf.hr NNTP-Posting-Date: 26 Sep 1998 15:36:14 GMT User-Agent: tin/pre-1.4-980730 (UNIX) (SunOS/5.6 (sun4u)) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Eneko Lacunza 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 and call _fpcontrol(MSW_EM,MSW_EM) at the beggining of main(). This will disable FPEs. --