Subject: Re: very large reals?
From: Erik Naggum <erik@naggum.net>
Date: Wed, 20 Feb 2002 22:30:06 GMT
Newsgroups: comp.lang.lisp
Message-ID: <3223233009092284@naggum.net>

* Rahul Jain
| If you really don't care about precision, you could try operating on the
| logs of the values in question, and multiplying instead of
| exponentiating, etc.  I suppose doing (expt (round number) base) would be
| the way of converting them back to bignums.

  If you choose base 10, computing with the logarithms is pretty easy for
  most mathematical operations.  Printing the value is not very hard,
  either: Just print the antilogarithm of the fractional part followed by
  the usual E and the integral part with a sign, and voila! you have the
  regular floating-point format.  Reading such numbers back in into
  logarithmic form is also a piece of cake: read the string, split it on
  the exponent marker, read the floating point number from the string, take
  the logarithm, which should now be in the range [0,1), and just add the
  integer exponent you read from the rest of the string.  This way, you can
  work with floating-point representations of logarithms.  It might take
  some getting used to, but before computers, people used to work with
  logarithmic projections all the time.  Remember the slide rule?  :)

///
-- 
  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.