gnu-misc-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GMP precision problem - only getting 15 places of PI


From: mensanator
Subject: Re: GMP precision problem - only getting 15 places of PI
Date: 21 Sep 2005 00:49:47 -0700
User-agent: G2/0.2

nmenuj@gmail.com wrote:
> I hadn't heard of the Collatz sequence before, and read up a little on
> it today. Also saw some of your correspondence on sci.math.

If you're interested, here are a couple Google groups set up for the
Collatz Conjecture.


This one's by Ernst Berg (you may have seen his name on sci.math also).

http://groups.google.com/group/Dymanic_Systems


And this one's mine (somewhat quiet as I've been spending most of my
time in Ernst's group learning C and GMP).

http://groups.google.com/group/TrueButUnproven


>
> About the linker problem with g++ on Cygwin, I have run into it several
> times, and have discovered that re-ordering your libraries works
> sometimes. For example, on my system,
>
> g++ -lgmp -lgmpxx pi.cpp
> generates large numbers of "undefined reference" errors, but the
> following works just fine:
>
> g++ pi.cpp -lgmp -lgmpxx
>
> (i.e., put the source file name before the libraries). No idea why it
> works, though.

Well, I have some ideas why it doesn't work. The -lgmpxx
option tries to link to a library file named libgmpxx.la.
This library does not exist on the computer I was trying
it on. I even re-ran the GMP configure and set the flag to
enable g++ support with no luck. I can't see any error in
the log file, but libgmpss.la is not getting built. When I
first tried to use GMP I found out that the GMP makefile
depends on a bunch of other tools that are NOT installed
by default by Cygwin even when you specifically tell it to
install gcc and g++. I figured out (I think) what was missing
by much trial and error, wailing and gnashing of teeth.
So I got GMP to work with the gcc compiler. Probably I
missed something from the Cygwin install that's preventing
the gmpxx library from being built.

The good news is that on my other computer the Cygwin/GMP
install does have the libgmpxx.la library, so I must have
accidently installed it correctly.

And your program compiles and runs without error on that
computer. So I can actually do c++ now. I'll have to run my
standard Collatz benchmark (2**177149 - 1) through it to see
how it compares to C and Python.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]