<div class="gmail_quote">On Sat, Dec 3, 2011 at 11:54 PM, Stas Boukarev <span dir="ltr"><<a href="mailto:stassats@gmail.com">stassats@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">Hans Hübner <<a href="mailto:hans.huebner@gmail.com">hans.huebner@gmail.com</a>> writes:<br>
<br>
> 2011/12/4 István Lakatos <<a href="mailto:lakatos.isti@gmail.com">lakatos.isti@gmail.com</a>>:<br>
>> The problem I ran into while trying to implement RSA in Common Lisp for my<br>
>> cryptography class was calculating the square root of a bignum (to<br>
>> demonstrate the Wiener attack on the cipher). There seems to be no bignum<br>
>> equivalent to floating point numbers. Are there any libraries that rectify<br>
>> this issue? I couldn't seem to find any.<br>
><br>
> Clozure CL implements EXPT and SQRT for bignums.<br>
</div>Every implementation does that. But it may overflow double floats.<br>
<br></blockquote><div>This is required by the ANS.</div><div> </div><div>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...</div>
<div>.</div><div>(*) -- 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.</div>
</div>