0.7 / 1.0 ?= 0.52

Torbjorn Granlund tg at gmplib.org
Thu Jun 14 22:42:54 CEST 2012

János Kukoda <kukodajanos at gmail.com> writes:

  I have a 5.0.4 GMP downloaded, installed from MacPort. I use it with
  the newest Xcode, updated just now.
It sounds both like you are using it precompiled, and as if you compiled
it yourself.  Which is the case?

  gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)
LLVM is an extremely buggy compiler.

  The division produce a funny bug. What do you think?
      mpf_t a;
      mpf_set_d(a, 0.7);
      mpf_t b;
      mpf_set_d(b, 1.0);
      mpf_t l;
      gmp_printf ("%.*Ff \n", 5, a);		--- 0.70000
      gmp_printf ("%.*Ff \n", 5, b);		--- 1.00000
      mpf_div(l, a, b);
      gmp_printf ("%.*Ff", 5, l);			--- 0.52502

I cannot compile that code, and I do not intend to try to add missing
pieces in the hope that I might get lucky and reproduce the problem.

"A test program that makes it possible for us to reproduce the
bug. Include instructions on how to run the program."

Sending in sloppy bug reports wastes your time and ours.

More information about the gmp-bugs mailing list