(Repost) Replacement for GMP as Bignum: ARPREC? Haskell?;
OS X and OpenSSL
p.tanski at gmail.com
p.tanski at gmail.com
Sat Jul 29 23:21:07 EDT 2006
(Sorry for the repost: I needed to correct a few typos--thanks
Seth--and clarify a few things.)
GHC Task Ticket # 601 suggests replacing GMP with OpenSSL's Bignum library, BN.
I have two questions concerning this:
(1) Why not use the ARbitrary PRECision Computation Package (ARPREC)
by David Bailey, Yozo Hida, Karthik Jeyabalan, Xiaoye Li and Brandon
Thompson? Here is a reference web page:
http://crd.lbl.gov/~dhbailey/mpdist/
ARPREC is written in C++ but supports calls from C (see
include/arprec/c_mp.h in the distribution directory). ARPREC is very
fast and supports more complex mathematics than BN. The Licensing for
ARPREC is not a problem: essentially similar to BSD3.
Note that there would be a basic configuration fix for building
OpenSSL's BN library on OS 10.4: you would probably--I had to,
myself--have to temporarily move the default installation of
/usr/lib/libssl0.9.dylib (and variants) if you want to create a static
(.a) library because Apple's ln links dynamic libraries in preference
to static libraries.
(2) A much more aesthetic solution would be to replace any external
Bignum library with a pure Haskell library. There are many problems
with building a truly efficient and fast Bignum library in Haskell but
challenges like that are how languages evolve... Both GHC and nhc98
seem to use GMP, OCaml uses a custom bignum library written by Xavier
Leroy and even MLton uses GMP. Robert Dockins wrote a type-based
library for arbitrary that can (slowly) handle big numbers (up to
10^15), see http://www.eecs.tufts.edu/~rdocki01/typenats.html I don't
know what the constraints on making such native Integer support work
in GHC but my comment on the evolution of Haskell was not meant badly:
native Integer support would require modifications to how Integers are
handled in memory. (I would be glad to lend whatever support I could
on this, but it seems like a big project.)
-Peter Tanski
More information about the Glasgow-haskell-users
mailing list