Subject: Floating Point and 486's
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: David B. Wollner <dwollner@popmail.ucsd.edu>
List: current-users
Date: 04/28/1994 10:56:59
I am trying to port a postscript interpreter to NetBSD-current (iastate
binaries as of a couple of days ago).  I'm hitting an interesting bug where
a float parameter I sent to the subroutine changes it's value dramatically
within the subroutine.  A copy of my test program is appended below.  If
anyone has any information, I would appreciate it!

        - dbw

void checkparam();

main()
{
        float f1, f2;
        char *p = "this is a test";

        for (f1=1.56; f1 < 15000.0; f1++){
                f2 = f1 + 1.43;
                f2 = f1 + ((f1 - f2) * (f1 - f2)) / (f1 - f2);
                checkparam(p, f1, f2, &f1, &f2);
        }
}

void
checkparam(cp, f1, f2, pf1, pf2)
char *cp;
float f1, f2;
float *pf1, *pf2;
{
        float f3, f4 = 27.56;

        if (f1 != *pf1)
                printf("Parameter error 1 %f, %f\n", f1, *pf1);
        if (f2 != *pf2)
                printf("Parameter error 2 %f, %f\n", f2, *pf2);
        f3 = f4 = f1;
        if (f3 != f1)
                printf("Replacement error %f, %f\n", f3, f1);
}



------------------------------------------------------------------------------