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

Re: m68k OCaml porting issue



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


Reply to: