Port-amd64 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Changing x87 precision to full 63bit as default



Joerg Sonnenberger <joerg%britannica.bec.de@localhost> writes:

> What exactly have you tried?

This code:

#include <stdio.h>
#include <ieeefp.h>

int
main(int argc, char *argv[])
{
        volatile double x, y, r;

        if (argc > 1) {
                fp_prec_t oldprec;
                oldprec = fpsetprec(FP_PD);
                printf("prec %d -> %d\n", oldprec, FP_PD);
        }
        x = 3002399751580332.0;
        y = 3002399751580331.0;
        r = x / y;
        printf("%.16f, %.16f, %.16f\n", x, y, r);

        return 0;
}

And result was
% ./t
3002399751580332.0000000000000000, 3002399751580331.0000000000000000, 
1.0000000000000004
% ./t setprec
prec 3 -> 2
3002399751580332.0000000000000000, 3002399751580331.0000000000000000, 
1.0000000000000002

Compiling with -ffloat-store and/or -fexcess-precision=standard was
some result.

enami.


Home | Main Index | Thread Index | Old Index