Xref: news-dnh.mv.net comp.os.msdos.djgpp:2518 Path: news-dnh.mv.net!mv!news.NH.Destek.Net!news2.net99.net!news.cais.net!uunet!in2.uu.net!news.mathworks.com!newsfeed.internetmci.com!news.sprintlink.net!dnaco.net!eheft From: eheft AT sisko DOT dnaco DOT net (eheft) Newsgroups: comp.os.msdos.djgpp Subject: Q: Moving from V1.12.3 to V2.0 Date: 9 Oct 1995 20:32:44 GMT Organization: The Dayton Network Access Company (DNACo) Lines: 64 Nntp-Posting-Host: eheft AT kirk DOT dnaco DOT net To: djgpp AT sun DOT soe DOT clarkson DOT edu Dj-Gateway: from newsgroup comp.os.msdos.djgpp Hi as the subject says I'm moving code from V1.12.3 to V2.0 and I've encountered some errors from code that ran fine before. First let me ask what all generates a Floating Point Error? I've tracked down a FPE error to an assignment like f1 = f2 - f3; /* where all fn's are vars of type float */ The second problem was with this code: /*------------------------------------------------------------ For some reason this code gave me a segfault about 1/3rd of the way though the loop. I checked data,x,y were all good. -------------------------------------------------------------*/ void Shift(float *data,long x,long y) { int dx,dy,i; float v; for (dy=0; dy < y; dy++) { for (dx=0; dx < x; dx++) { i = 2 * ( dx + ( dy * x )); v = (dx + dy) % 2 * -2 + 1; data[ i+0 ] *= v; data[ i+1 ] *= v; } } } /*----------------------------------------------------------- This function no longer gives seg faults. but its missing the i+1 assignment. BTW: data is a 2D array of complex #'s ------------------------------------------------------------*/ void Shift(float data[],long dx,long dy) { int x,y; float v; for (y=0 ; ydata,cp->dx,cp->dy); Thanks for any light you can shed on this. -- Eric