On 16/06/2010 01:48, peter wilson wrote:
> At one point, many tears (a Freudian slip --- I meant to write `years')
> ago, I needed to manipulate large numbers within LaTeX and wrote a
> package to do so. I never released it and it has gone the way of several
> computer upgrades. In any case, it handled mantissas in the range 0 --
> 1,000,000,000 with exponents in the range of +/- 0 -- 1,000,000,000.
> Would you consider extending your basic l3fp module to include
> exponents, perhaps, if necessary by being able to switch between the
> current 18 significant digits to 9 significant digits + exponent.
>
> Peter W.

My first plan had been to do everything internally in exponent form, but 
I realised it would be very inefficient for the large number of cases 
where it was not needed. Thinking about it some more, I wonder about the 
following:

  - Input without exponent: calculate as currently, and shift result to 
exponent form if there is an overflow.
  - Input in exponent form: calculate with exponents, shift result 
either to appropriate exponent form or drop exponent if not needed.

That should still be reasonably fast (there are just a few extra checks 
for input which is not exponent-containing), and I think not too hard to 
do. Certainly not as hard as working out how to do sin, cos, etc. (I'm 
currently reading about the CORDIC method for this: probably need to do 
some speed tests. The fp package does not explain the algorithm it uses, 
so I may have to work it all out by hand.)
--
Joseph Wrigh