Arbitrary or Infinite-Precision Library

Mar 16, 2011 at 12:32am
I'm writing a script that calculates pi, and I need a good infinite-precision floating-point number type. I tried apfloat, but I wasn't sure exactly what to do with all of those files.

Can someone help me install apfloat or a similar library that's compatible with Xcode and the Intel x86_64 processor?
Mar 16, 2011 at 12:59am
http://www.apfloat.org/apfloat/2.41/
apfloat wrote:

Choose and download the files for the version you want. Pick the correct files for your processor, operating system, compiler, and select either the 32-bit or the 64-bit version.
First unzip the common source files package, apf241.zip, to an empty directory.
Then unzip the version-specific package(s) (like 32_vc.zip) to the same directory. Be sure to OVERWRITE all files. From the command line, unzip with the -o switch. With WinZip, just say Yes to overwrite all files.
Compile the library, or whatever you want. Depending on the version you downloaded, you may need to execute from the command line e.g. "make lib" or "nmake aptest.exe" etc.


What step are you having problems with?
Last edited on Mar 16, 2011 at 12:59am
Mar 16, 2011 at 5:03am
Another option is gmp:

http://gmplib.org/
Mar 16, 2011 at 9:47pm
@hanst99 There wasn't an option for Snow Leopard or even OS X in general with an Intel processor (only PPC) , so I picked "x86-64 (AMD-64 or Intel EM64T) gcc" and downloaded that file and the common files. I unarchived both, then moved all the files from the x86 folder to the common folder, replacing all with the same filename. The instructions weren't very specific, so I tacked ".txt" onto the end of the readme file, and read it. Then I launched Terminal, cd'd to the folder where I'd unarchived all of those files, and typed "make lib" . I got this:
g++ -O3 -ffast-math -g -w -DBIN=binary  -c datastru.cpp
In file included from datastru.cpp:2:
ap.h:93: error: declaration of C function ‘int truncate(const char*, long int)’ conflicts with
/usr/include/unistd.h:501: error: previous declaration ‘int truncate(const char*, off_t)’ here
make: *** [datastru.o] Error 1
Mar 16, 2011 at 9:49pm
@Disch Thanks; I'll keep that in mind, but apfloat seems to "just work" (at least, more so than GMP. It could just come with a script that'd install the darn thing for me) without having to use special function calls just to add and multiply.
Topic archived. No new replies allowed.