Received: from mx0.gmx.net (mx0.gmx.net [213.165.64.100]) by h1439878.stratoserver.net (8.14.2/8.14.2/Debian-2build1) with SMTP id o5G3pCeK024008 for ; Wed, 16 Jun 2010 05:51:13 +0200 Received: (qmail 8668 invoked by alias); 16 Jun 2010 03:51:07 -0000 Delivered-To: GMX delivery to rainer.schoepf@gmx.net Received: (qmail invoked by alias); 16 Jun 2010 03:51:06 -0000 Received: from relay.uni-heidelberg.de (EHLO relay.uni-heidelberg.de) [129.206.100.212] by mx0.gmx.net (mx004) with SMTP; 16 Jun 2010 05:51:06 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id o5G3mX4I022075 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 16 Jun 2010 05:48:33 +0200 Received: from listserv.uni-heidelberg.de (localhost.localdomain [127.0.0.1]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id o5FM151W020186; Wed, 16 Jun 2010 05:48:26 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 432503 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Wed, 16 Jun 2010 05:48:26 +0200 Received: from relay2.uni-heidelberg.de (relay2.uni-heidelberg.de [129.206.210.211]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id o5G3mQsY018040 for ; Wed, 16 Jun 2010 05:48:26 +0200 Received: from elasmtp-junco.atl.sa.earthlink.net (elasmtp-junco.atl.sa.earthlink.net [209.86.89.63]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id o5G3mFbD018530 for ; Wed, 16 Jun 2010 05:48:18 +0200 Received: from [65.101.133.125] (helo=[192.168.2.3]) by elasmtp-junco.atl.sa.earthlink.net with esmtpa (Exim 4.67) (envelope-from ) id 1OOjbl-0004gm-Pt for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Tue, 15 Jun 2010 23:48:10 -0400 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20060212 Fedora/1.7.12-5 X-Accept-Language: en-us, en MIME-Version: 1.0 References: <4C17EAC4.60705@morningstar2.co.uk> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-ELNK-Trace: 2d75d9567fada10dc3b6ad7bd0984c4474bf435c0eb9d47874ac9a0a2a4447dabfdaeac2ac68a389c3537ce24867c1ad350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 65.101.133.125 Message-ID: <4C181F6A.2060308@earthlink.net> Date: Tue, 15 Jun 2010 20:48:42 -0400 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: peter wilson Subject: Re: l3fp: A floating point unit for expl3 To: LATEX-L@listserv.uni-heidelberg.de In-Reply-To: <4C17EAC4.60705@morningstar2.co.uk> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=5D7Q89H36p77e5KAPs1l6v/Sb97LojnDtMgfETrECMLUO9erHzOJe+OynZRhvlGqvET/J 3dm2vHWnQHIuidpgLhS+P7NNYz+zyHLMY9yCwGeoj9BiPgazSVDQFsQIW5ndJCbWUGBVgH7296LE WpM6A==V1; X-Resent-By: Forwarder X-Resent-For: rainer.schoepf@gmx.net X-Resent-To: rainer@rainer-schoepf.de Status: R X-Status: X-Keywords: X-UID: 6336 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 > > which adds and and assigns the result to . 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 > > which adds to the current content of (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 > well-known 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 pseudo-random > 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.