Fixed. Thanks for the report. Aside from being a helper function for sqrt, exact-integer-sqrt is available in some Lisp and Scheme implementations. At first glance, you might think that calling (floor (sqrt n)) is sufficient, and no special function is needed. But for large integers which are not square, sqrt converts them to a double, and precision is lost. So if you really need to know the (floor (sqrt n)), something like exact-integer-sqrt is needed.
I don't know how commonly used this is, but since it is needed anyway internally, and might be useful externally, I think that's why many implementations expose it. On Sun, Mar 29, 2009 at 7:00 AM, 이휘재 <hj.d....@gmail.com> wrote: > Hi, all. > > (clojure.contrib.math/exact-integer-sqrt 1000000000000) > => [65536 995705032704] > > due to typo in "integer-length". > > must be: > (clojure.contrib.math/exact-integer-sqrt 1000000000000) > => [1000000 0] > > -- > aside, > does "integer-sqrt" need to be public? > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---