[pro] Bignum Arithmetic

Steve Haflich shaflich at gmail.com
Sun Dec 4 23:17:00 UTC 2011


On Sat, Dec 3, 2011 at 11:54 PM, Stas Boukarev <stassats at gmail.com> wrote:

> Hans Hübner <hans.huebner at gmail.com> writes:
>
> > 2011/12/4 István Lakatos <lakatos.isti at gmail.com>:
> >> The problem I ran into while trying to implement RSA in Common Lisp for
> my
> >> cryptography class was calculating the square root of a bignum (to
> >> demonstrate the Wiener attack on the cipher). There seems to be no
> bignum
> >> equivalent to floating point numbers. Are there any libraries that
> rectify
> >> this issue? I couldn't seem to find any.
> >
> > Clozure CL implements EXPT and SQRT for bignums.
> Every implementation does that. But it may overflow double floats.
>
> This is required by the ANS.

Numberical (*) calculations in ANSI CL usually devolve towards floats (or
complex floats) because ANSI CL is intended to be an "industrial strength"
programming language that mostly conforms to the usual efficiency
assumptions of IEEE float processors.  That gets you 64 or 80 or 81 bits,
depending.  But there is another venerable tradition of numerical (even
float) computation that preserves accuracy.  See the "bigfloat" capability
of Maxima (the public-domain version of Macsyma) open sourced at
Sourceforge.  Indeed, you might find that the easiest way to write the
computations you need would be to do them in Maxima (which is sort-of CL)
rather than trying to expropriate the Maxima source code.  HTH...
.
(*) -- This neologism was found on a door label sign at the Yale CS
department group for "numerical calculation" some time in the late 1970's.
 I've alwasy thought that this intentional illiteracy (misspelling) was
particularly witty.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/pro/attachments/20111204/8c387428/attachment.html>


More information about the pro mailing list