*BSD News Article 96615


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.cs.su.oz.au!metro!metro!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!newsfeed.nacamar.de!fu-berlin.de!news.belwue.de!news.bawue.de!luva.lb.bawue.de!luva.lb.bawue.de!not-for-mail
From: migieger@luva.lb.bawue.de (Michael Giegerich)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: FreeBSD 221 math problem, help
Date: 31 May 1997 16:26:50 +0200
Organization: BaWue-Net Ludwigsburg
Lines: 34
Message-ID: <5mpcfa$278@luva.lb.bawue.de>
References: <01bc6afa$0dd23720$3976c9ce@amuancw110> <338E6020.5045@OntheNet.com.au>
NNTP-Posting-Host: luva.lb.bawue.de
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:41970

In article <338E6020.5045@OntheNet.com.au>,
Tony Griffiths  <tonyg@OntheNet.com.au> wrote:
>Tim Brown wrote:
>> 
>> I am getting a math error (FPE) in some pretty old code.  The code works
...
>You're not using a Pentium with the FP bug by any chance?
>
>Is there a program on the net for testing if you have a "dud" Pentium? 

Here's a C source I picked from the net some
time ago (sorry, don't know who to credit):

/*
Here is a simple test program that will reproduce the bug, if present;
if this prints "256.000000" as result, your system is affected; on a 486,
this prints "0.000000".
*/

#include <stdio.h>

int main()
{
    double x,y,z;

    x = 4195835.0;
    y = 3145727.0;
    z = x - (x / y) * y;
    printf("%f\n",z);
    return 0;
}

-- 
Michael Giegerich, E-Mail: migieger@luva.lb.bawue.de, Voice: +49 7144 39337