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

Re: m68k OCaml porting issue



Le 22/12/2021 à 15:40, John Paul Adrian Glaubitz a écrit :
Hi Stéphane!

On 12/22/21 14:47, Stéphane Glondu 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<-----

returns "-INF" instead of "-NAN".

It might be an emulation issue with QEMU which has some issues with FPU emulation.

I can test it on real hardware but not until after Christmas.

Adrian


With Qemu 6.2.50 (from git repo):

-NAN

With Quadra 800 with 68040 FPU:

NAN

Built with Qemu and debian bookworm/sid, gcc (Debian 10.2.0-15) 10.2.0.

On Quadra 800 it's executed on a debian/etch (not enough memory, 40 MB, to execute sid installer).

So it seems your test works better on Qemu than on real hardware.

First test gives me:

Qemu: fff0000000000001, -NAN
Q800: 7ff8000000000001, NAN

Qemu reuses fonctions common to all emulated archs, so we will have results closer to x86 than to real 68040.

Thanks,
Laurent


Reply to: