Find the causes of the problem:
Before execution of:
r = sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
we call:
distance=me_pnt_dist_2d(p_mt->pref, pc);
if(fabs(distance-radius)<p_mt->fOsnap){
p_mt->bFind=1;
return(0);
}
return(0);
where me_pnt_dist_2d was undeclared ,
double me_pnt_dist_2d(PNT_2D *p1, PNT_2D *p2);
the compiler assumes returning int, so
we call fabs() with a value that leads the
processor in an inconsistent state.
The strangeness is that part of the code works well.
846: r = sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
005AE147 fld qword ptr [x2]
005AE14A fsub qword ptr [x1]
005AE14D fld qword ptr [x2]
005AE150 fsub qword ptr [x1]
005AE153 fmulp st(1),st
005AE155 fld qword ptr [y2]
005AE158 fsub qword ptr [y1]