High precision arithmetic and PARI/GP
Currently I have some code in PARI/GP which implements computing values of a sequence based on a recurrence. All the numbers in this sequence are between 0 and 1 and high precision is important (at least 50 digits). Are there any languages which support parallel programming, high precision, and are able to do basic 开发者_StackOverflow社区arithmetic operations such as +,-,*,/ quickly (like PARI)?
Are there any languages which support parallel programming, high precision, and are able to do basic arithmetic operations such as +,-,*,/ quickly (like PARI)?
Slightly the wrong question - what you want to ask is are there any libraries that could bind to your language of choice that allow you to do arbitrary precision arithmetic.
The answer is yes. Take a look at GMP or the fork with a focus on also supporting Windows MPIR. Both of these will handle these basic arithmetic operations about as optimally as you can.
You may also find that additional libraries suited to your needs become useful, like MPRF or MPC.
These libraries have bindings to C and some C++ and also Python.
GMP specifically is part of the code powering PARI/GP, although PARI have added numerous extensions.
$ ldd gp
linux-vdso.so.1 => (0x00007fffe46d9000)
libreadline.so.6 => /lib64/libreadline.so.6 (0x0000003b01e00000)
libtinfo.so.5 => /lib64/libtinfo.so.5 (0x0000003b0d600000)
libpari-gmp.so.2 => /usr/lib64/libpari-gmp.so.2 (0x0000003afbe00000)
libdl.so.2 => /lib64/libdl.so.2 (0x0000003afb600000)
libm.so.6 => /lib64/libm.so.6 (0x0000003afba00000)
libgmp.so.3 => /usr/lib64/libgmp.so.3 (0x0000003afce00000)
libc.so.6 => /lib64/libc.so.6 (0x0000003afae00000)
/lib64/ld-linux-x86-64.so.2 (0x0000003afaa00000)
There's also MAPM and qd. See also High precision arithmetric in Python and/or C/C++?.
精彩评论