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 o5FL6o35013876 for ; Tue, 15 Jun 2010 23:06:52 +0200 Received: (qmail 18577 invoked by alias); 15 Jun 2010 21:06:45 -0000 Delivered-To: GMX delivery to rainer.schoepf@gmx.net Received: (qmail invoked by alias); 15 Jun 2010 21:06:44 -0000 Received: from relay2.uni-heidelberg.de (EHLO relay2.uni-heidelberg.de) [129.206.210.211] by mx0.gmx.net (mx022) with SMTP; 15 Jun 2010 23:06:44 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id o5FL4SBs022844 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 15 Jun 2010 23:04:29 +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 o5FG8YdZ014223; Tue, 15 Jun 2010 23:04:23 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 443922 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Tue, 15 Jun 2010 23:04:23 +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 o5FL4Nkj015728 for ; Tue, 15 Jun 2010 23:04:23 +0200 Received: from anchor-post-3.mail.demon.net (anchor-post-3.mail.demon.net [195.173.77.134]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id o5FL43k7022667 for ; Tue, 15 Jun 2010 23:04:07 +0200 Received: from cremornelane.demon.co.uk ([80.177.25.195] helo=palladium.local) by anchor-post-3.mail.demon.net with esmtp (Exim 4.69) id 1OOdIi-0007Ej-oG for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Tue, 15 Jun 2010 21:04:04 +0000 User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-GB; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <4C17EAC4.60705@morningstar2.co.uk> Date: Tue, 15 Jun 2010 22:04:04 +0100 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Joseph Wright Subject: l3fp: A floating point unit for expl3 To: LATEX-L@listserv.uni-heidelberg.de 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+zyHLMY9yCwGoTDtboDaDPUTmYi5shhPJySBzZnboYr4mQK+ZF NwOSQ==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: 6335 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