2 documentation bugs (5.0.2)
Zimmermann Paul
Paul.Zimmermann at loria.fr
Thu Nov 24 16:51:59 CET 2011
Dear Tim,
> The second doc bug could also be a library bug (depends on whether or not
> the behaviour is expected or not).
> Given:
>
> #include <gmp.h>
>
> #define MPF_BITS 128 /* same with 256 */
>
> int
> main(void) {
> mpf_t f;
> mpf_init2(f, MPF_BITS);
> mpf_set_str(f, "999.9999999", 10);
> gmp_printf("f is either %Ff or %.Ff, depending how you look at it\n", f,
> f);
> return 0;
> }
>
> You get as output: "f is either 1000.000000 or 999.9999999, depending how
> you look at it" (whereas I had expected the same number to be shown).
> The total number of digits seems to be irrelevant (I initially noticed the
> problem with 9999999999999999999999.9999999).
if it can help you, with GNU MPFR you would get:
tarte% ./a.out
Version: 3.1.0
f is either 1000.000000 or 1000.000000, depending how you look at it
tarte% cat bug.c
#include <stdio.h>
#include <mpfr.h>
int main(void) {
mpfr_t f;
printf("\n Version: %s\n\n", MPFR_VERSION_STRING);
mpfr_init2(f, 128);
mpfr_set_str(f, "999.9999999", 10, GMP_RNDN);
mpfr_printf("f is either %Rf or %.Rf, depending how you look at it\n", f, f);
return 0;
}
Best regards,
Paul Zimmermann
More information about the gmp-bugs
mailing list