Bug Report GMP-5.1.1 Mini-gmp t-double.c

Torbjorn Granlund tg at gmplib.org
Mon Feb 25 16:43:59 CET 2013

nisse at lysator.liu.se (Niels Möller) writes:

  Then, the actual problem, I think, is similar to the recently discussed
  problem with the main gmp testsuite on m68k. The mini-gmp test
    f = d + 1.0;
    if (f > d) ...
  Now, the problem is that the addition and comparison is done with
  extended precision (I guess it's the old fashioned 387 floating point
  unit registers), and then f > d, but after truncating to double
  precision, we get f == d.

You (Niels) might want to try this on m68k.gmplib.org, behind shell.
Pass e.g. -m68030, since the default is to compile for 68040 which has
proper instructions for IEEE double.  Triggering the bug before the
change and making sure it is fixed by the change would make some sense.

I suppose it could also be triggered on an x86 host, in 32-bit mode and
passing some flag like -march=i486 to make sure sse remain unused.

In both cases, optimising might be necessary.  That is not done by
default in mini-gmp testing.  And I don't know how to pass -O to the
Makefile.  Setting CFLAGS=-O causes havoc, and passing it in
EXTRA_CFLAGS has no effect on compilation flags...


More information about the gmp-bugs mailing list