Mail Archives: djgpp/1997/07/19/22:01:44
Michael Mauch wrote:
>
> On Fri, 18 Jul 1997 17:53:17 GMT, csantill AT lausd DOT k12 DOT ca DOT us wrote:
> > SIGFPE error(division by zero) at line 54:
> >
> > fps=7680/((t[2]-t[1])/UCLOCKS_PER_SEC)
> > or
> > fps=7680/((t[2]-t[1])/CLOCKS_PER_SEC)
> >
> > This is odd because it does not occur when I compile
> > w/O0 or O1.
>
> It seems that (t[2]-t[1])/UCLOCKS_PER_SEC _is_ 0 when you compile with
> O2 or O3. You are using integer arithmetics, so if the time between
> t[1] and t[2] is less than one second, the difference of t[1] and t[2]
...
please take a look at his code:
clock_t t[2];
with t[2] he is addressing the third element of a 2 element array. even
though dereferencing one past the end of the array is fine, that value
can be anything.
--
Sinan
*******************************************************************
A. Sinan Unur WWWWWW
|--O+O
mailto:sinan DOT unur AT cornell DOT edu C ^
http://www.people.cornell.edu/pages/asu1/ \ ~/
Unsolicited e-mail is _not_ welcome, and will be billed for.
*******************************************************************
- Raw text -