rbowler / spinhawk

spinhawk is the repository for the production-quality version (release 3.xx) of the Hercules mainframe virtualization platform
Other
100 stars 41 forks source link

double NaN to float conversion problem #7

Closed pcpa closed 10 years ago

pcpa commented 10 years ago

I have been told to report here an issue I suspected could be a Hercules emulator problem, and was told it works (does not abort) on actual hardware. This small test program fails on hercules-3.08.2-1.fc20.x86_64 using a fedora 16 image:

extern void abort(void);

void
test(float f)
{
    float fnan = 0.0f/0.0f;
    if (*(int*)&f != *(int*)&fnan)
        abort();
}

int
main(int argc, char *argv[])
{
        double dnan = 0.0/0.0;
        test(dnan);
        return 0;
}
sharkcz commented 10 years ago

from Paulo's email sent to me: ... But reading objdump output, it is supposed to be done by the hardware, in both cases, the instruction:

ledbr %f0,%f0

rbowler commented 10 years ago

All production versions of Hercules up to 3.09 contain only a partial implementation of IEEE floating point (BFP in mainframe terminology). This partial implementation is known to produce incorrect results for certain operations. The development version of Hercules has addressed this problem by replacing the partial BFP implementation by calls to the softfloat package, which while slower does produce correct results. The modification has not yet been retrofitted into the production versions of Hercules but it is in the plan.

rbowler commented 10 years ago

This bug is now scheduled for correction in release 3.10

rbowler commented 10 years ago

Bug has been corrected by spinhawk commit ee5f56ae118edcf18d2f9900e27dd914bc60b7a3 which will be included in the next release (3.10)

rbowler commented 10 years ago

Fixed by release 3.10