Re: floating point exception

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Wed Jan 16 2002 - 17:05:55 EST


On Wed, 16 Jan 2002, Brian Gerst wrote:

> "Richard B. Johnson" wrote:
> >
> > On 16 Jan 2002, Christian Thalinger wrote:
> >
> > > On Wed, 2002-01-16 at 15:32, Zwane Mwaikambo wrote:
> > > > Can you also reproduce _without_ loading NVdriver, just to make everybody
> > > > happy.
> > > >
> > > > Thanks,
> > > > Zwane Mwaikambo
> > > >
> > >
> > > Sure, same breakdown. Maybe it's really an dual athlon xp issue as dave
> > > jones mentioned. But shouldn't this also occur when i trigger a floating
> > > point exception myself? Is there a way to check which floating point
> > > exception was raised by the seti client?
> > >
> > > Regards.
> > >
[SNIPPED...]

> > into one array. Then you do the exact same thing with the results
> > put into another array. Then just `memcmp` the arrays! You run
> > this in a loop for an hour. If the kernel is mucking with your FPU,
> > it will certainly show.
>
> Hmm, that's an interesting idea... An Athlon optimised kernel does use
> the MMX/FPU registers to do mem copies. Try running a kernel compiled
> for just a Pentium and see if the problem persists.
>

Here's a progy.. This SHOULD run forever. I assume malloc() works and
don't check the result --yes I already know that.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <time.h>
#include <math.h>

#define MAX_FLOAT 0x100000

int main(int args, char *argv[])
{
    unsigned int seed;
    double *x;
    double *y;
    double *z;
    size_t i;
    x = (double *) malloc(MAX_FLOAT * sizeof(double));
    y = (double *) malloc(MAX_FLOAT * sizeof(double));
    (void) time((time_t *)&seed);
    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();
    }
    fprintf(stderr, "Floating point failure\n");
    return 1;
}

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/



This archive was generated by hypermail 2b29 : Wed Jan 23 2002 - 21:00:18 EST