Inaccurate/inconsistent output from mpf_out_str

Yihang Ho hoyihang5 at gmail.com
Fri Oct 30 13:11:48 UTC 2015


Hi Leif,

Ah, that solves the problem. Thanks!

Anyway, just curious, why is this even happening? AFAIK, I didn't have GMP
installed (it's a fresh Ubuntu VM). In fact, before make install (or after
make uninstall), my code won't even compile. After make install, my code
compiles, but says version 6.0.0. After ldconfig, it it goes to 6.0.99. Any
idea why 6.0.0 appears in the first place?

Yihang

On Fri, Oct 30, 2015 at 9:02 PM Leif Leonhardy <not.really at online.de> wrote:

> Yihang Ho wrote:
> > Hi Marco,
> >
> > Statically linking the library as you showed works nicely. But why does
> the
> > first version says version 6.0.0? (I sudo make install after compiling.)
>
> In case you're on Linux, presumably due to ld.so caching.
>
> If so, run 'ldconfig' after 'make install' such that the dynamic linker
> will pick up the /new/ version of the library.
>
> (You could also specify the absolute path to the new dynamic library
> when linking to avoid using an old one, provided the version numbers
> sufficiently differ; otherwise you have to make sure the loader picks up
> the correct one when loading your program as well.)
>
>
> -leif
>
>
> > On Fri, Oct 30, 2015 at 4:06 AM Marco Bodrato <bodrato at mail.dm.unipi.it>
> > wrote:
> >
> >> Ciao,
> >>
> >> Il Gio, 29 Ottobre 2015 6:05 pm, Yihang Ho ha scritto:
> >>> Not sure if I compiled the RC correctly, but I am still seeing the same
> >>> results.
> >>
> >> If "make check" did not fail, it was correctly compiled. Are you using
> for
> >> your test? I added a line at the beginning of your code:
> >> printf("%s\n",gmp_version);
> >>
> >> I get:
> >>
> >> $ g++ sample.cpp -lgmp && ./a.out
> >> 6.0.0
> >> 0.2628983284e208987640249978734
> >> 0.2628978818679220467407506489160042807743550216147e208987640249978734
> >> ....
> >>
> >> $ g++ sample.cpp .libs/libgmp.a && ./a.out
> >> 6.0.99
> >> 0.2628978819e208987640249978734
> >> 0.26289788186792204674075064891600428077435502009263e208987640249978734
> >> ....
> >>
> >> (the second instance is statically linked with the compiled, but not
> >> installed, library, and it prints 6.0.99 for the version)
> >>
> >> Regards,
> >> m
> >>
> >> --
> >> http://bodrato.it/papers/
>
>


More information about the gmp-bugs mailing list