• Re: m68k OCaml porting issue

    From John Klos@21:1/5 to All on Wed Dec 22 20:00:02 2021
    Another simpler example, not involving unions:

    -----8<-----
    #include <stdio.h>
    #include <math.h>
    #include <stdlib.h>

    int main(int argc, char** argv) {
    double d[2];
    d[0] = NAN;
    d[1] = -d[0];
    printf("%F\n", d[1]);
    }
    -----8<-----

    Gives NAN on '030 & '882, '040, '060, with gcc 7.4.0 & gcc 10.3.0.

    Does Linux support softfloat? That'd be one way to get proper math out of
    qemu.

    John

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Brad Boyer@21:1/5 to John Klos on Fri Dec 24 22:40:02 2021
    On Wed, Dec 22, 2021 at 06:43:55PM +0000, John Klos wrote:
    Another simpler example, not involving unions:

    -----8<-----
    #include <stdio.h>
    #include <math.h>
    #include <stdlib.h>

    int main(int argc, char** argv) {
    double d[2];
    d[0] = NAN;
    d[1] = -d[0];
    printf("%F\n", d[1]);
    }
    -----8<-----

    Gives NAN on '030 & '882, '040, '060, with gcc 7.4.0 & gcc 10.3.0.

    The m68k PRM would seem to indicate that the FPU in both the 6888x and
    the 68040 doesn't do a signed NAN. It specifically lists the sign bit
    as a don't care bit for NAN while zero and infinity are both listed
    as being signed quantities.

    It seems to me this is expected behavior on the real hardware.

    Brad Boyer
    flar@allandria.com

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)