lkml.org 
[lkml]   [2002]   [Jan]   [16]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateWed, 16 Jan 2002 17:23:42 -0500 (EST)
From"Richard B. Johnson" <>
SubjectRe: floating point exception
On Wed, 16 Jan 2002, Mark Zealey wrote:

> On Wed, Jan 16, 2002 at 05:05:55PM -0500, Richard B. Johnson wrote:
> 
> >     for(;;)
> >     {
> >         srand(seed); 
            ^^^^^^^^^^^^^^^^

> >         z = x;
> >         for(i = 0; i < MAX_FLOAT; i++)
> >             *z++ = cos((double) rand());
> >         srand(seed);
            ^^^^^^^^^^^^^

> >         z = y;
> >         for(i = 0; i < MAX_FLOAT; i++)
> >             *z++ = cos((double) rand());
> >         if(memcmp(x, y, MAX_FLOAT * sizeof(double)))
> >             break;
> >         seed = rand();
> 
> Um, maybe I'm not reading this properly.. why are you randing, doing 1 set and
> then using different random values for the other set ?

I am NOT. I am setting the seed BACK to whatever it was for the first
set with srand(seed). After the compare, I change the seed.


Cheers,
Dick Johnson

Penguin : Linux version 2.4.1 on an i686 machine (797.90 BogoMips).

    I was going to compile a list of innovations that could be
    attributed to Microsoft. Once I realized that Ctrl-Alt-Del
    was handled in the BIOS, I found that there aren't any.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:23    [W:0.246 / U:0.170 seconds]
©2003-2008 Jasper Spaans