0.7 / 1.0 ?= 0.52

Hans Aberg haberg-1 at telia.com
Fri Jun 15 18:13:30 CEST 2012


On 15 Jun 2012, at 17:18, Torbjorn Granlund wrote:

> Hans Aberg <haberg-1 at telia.com> writes:
> 
>  I had to wrap it into a function, and change the Haskell style '--'
>  comments into C/C++ style (see below). Then just use any of the
>  compilers mentioned above.
> 
> 
>    gmp_printf ("%.*Ff \n", 5, b);	// Prints 1.00000
> 
>    mpf_div(l, a, b);
>    gmp_printf ("%.*Ff", 5, l);		// Prints 0.70000
> 
> Wait a minute, you edited the comment...

Right. In C/C++, '--' is a decrement operator. :-)

> ..to say what your expect to get
> printed!

To what actually is printed when using all compilers, llvm-gcc, clang, and gcc 4.7.0.

>  Perhaps the pesky llvm read your comment and got things right
> as a result.

It prints the same with other value in the comment. :-)

> (Seriously though, we cannot draw any conclusion by this debacle.  The
> guy might have really buggy code which corrupted the heap and stack,
> provoking a state in which anything can happen from a GMP call.  I think
> that's actually at least as likely as having struck an llvm bug.  No
> real test case, no case!)

It could be an error in the code we didn't see, or possibly a bug in the MacPorts port, but it is not possible to tell by the current information in hand. Perhaps the OP can clarify.

Hans




More information about the gmp-bugs mailing list