Subject: Re: More: Very large reals...
From: Erik Naggum <>
Date: Fri, 22 Feb 2002 21:03:14 GMT
Newsgroups: comp.lang.lisp
Message-ID: <>

* Deepak Goel <>
| Going by your responses to the last question, a suggested solution may be:
| (expt 201/2 201/2)
| but give it a try on your lisp, to see that the latter doesn't work
| either.  (this is because an operation on 2 rationals has resulted in
| an irrational here...)..  And for irrationals, lisp tries to convert
| them to floats and then butts out if the inbuilt float limitations do
| not allow it..   Isn't it bizarre that (expt 201 201) is okay, but
| (expt 201/2 201/2) can't be calculated? 
| i guess the only solution is the roundabout way of working with logs.

  Well, for the case where you have an integral exponent of 1/2, you can
  play with this

(let* ((integral (expt 201/2 201)))
   (/ (isqrt (numerator integral)) (isqrt (denominator integral))))

  Note that this might not provide an exceptionally accurate result.  :)

  There are algorithms to compute the integer part of (expt m 1/n) for most
  integral values of n.

| [1] this is just a newbie trying to find a relevant package that does his
| job.  This is NOT a request to CHANGE the language!  lisp is awesome, as
| are the (mostly silent...) majority on the ng, but judging from the gurus
| fighting, some insecure people will interpret even an innocuous question
| of a newbie as an 'attack' on lisp.. heavens lord!

  What nonsense, but it is a kind of self-fulfilling nonsense, because you
  piss people off and tend to push them over on the defensive with your own
  attitude, here.  Keep such inflammatory comments to yourself.  You have a
  job to do: Learn Common Lisp.  Just stick to it, and you will get help.
  Ignore the likes of Erann Gat whose job it seems to be to make people
  stop using Common Lisp unless it is somehow magically "enhanced" to his
  satisfaction.  The rest of object to this nay-saying and just want to do
  our job: use Common Lisp productively in our own carreers and/or for fun.

  In a fight against something, the fight has value, victory has none.
  In a fight for something, the fight is a loss, victory merely relief.