Joseph Wright wrote:
> Hello all,
>
> Those of you who take an interest in the LaTeX3 SVN may have noticed
> that I've just added the beginnings of a 'l3fp' module as part of expl3.
> This is intended to provide a set of floating point functions for LaTeX3.
>
> As you'll all know, floating point work in TeX is not exactly easy
> (excepting when using LuaTeX, where of course the Lua route is
> available). The aim of l3fp is to provide accurate floating point
> functions (i.e. not using dimens) with a reasonable range of input and
> written for speed so that the module is generally useful.
>
> At the moment there are only a small set of basic arithmetic functions
> available in l3fp. So for example there is
>
> \fp_add:Nnn <var> <a> <b>
>
> which adds <a> and <b> and assigns the result to <var>. I've also
> defined an 'fp' data type, which is currently simply a macro which
> contains a number. So there is also a function
>
> \fp_add:Nn <var> <a>
>
> which adds <a> to the current content of <var> (which of course should
> be an fp).
>
> In terms of input range, I've gone for 999999999.999999999 to
> +999999999.999999999. This should be sufficient for a wide range of
> purposes (for example, if you convert a dimen into a floating point
> number in units pt then you are safe for any dimen TeX can handle).
>
> The design of the internals of the package is loosely following the
> wellknown fp package. However, that package is rather slow, at least
> partly as it handles 18 digits either side of the decimal. The approach
> in l3fp currently delivers addition, subtraction, multiplication and
> division much faster than fp does (between about 8 and 15 times as fast
> for a large number of repeated calculations). I hope this makes the
> module fast enough for practical use.
>
> The next phase is to add some more complex functions. I'm planning to
> cover trigonometry, exponential/ln and roots, plus a pseudorandom
> number generator and a few utility functions. They may take a while:
> getting it right is not that easy.
>
> Feedback on the module is very welcome, for example on which functions
> to provide, bugs (there are bound to be some), etc.
> 
> Joseph Wright
>
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.
