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 o5GCMQOf009865 for ; Wed, 16 Jun 2010 14:22:28 +0200 Received: (qmail 10042 invoked by alias); 16 Jun 2010 12:22:20 -0000 Delivered-To: GMX delivery to rainer.schoepf@gmx.net Received: (qmail invoked by alias); 16 Jun 2010 12:22:20 -0000 Received: from relay.uni-heidelberg.de (EHLO relay.uni-heidelberg.de) [129.206.100.212] by mx0.gmx.net (mx044) with SMTP; 16 Jun 2010 14:22:20 +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 o5GCK8Hh024249 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 16 Jun 2010 14:20:08 +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 o5GArNuk020186; Wed, 16 Jun 2010 14:20:04 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 438288 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Wed, 16 Jun 2010 14:20:04 +0200 Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id o5GCK4KK010703 for ; Wed, 16 Jun 2010 14:20:04 +0200 Received: from csep02.cliche.se (csep02.cliche.se [195.249.40.184]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id o5GCJfEs023709 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 16 Jun 2010 14:19:46 +0200 Received: from hexley.local (unknown [130.239.119.188]) by csep02.cliche.se (Postfix) with ESMTP id 3ADD0186659 for ; Wed, 16 Jun 2010 14:19:40 +0200 (CEST) User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812) MIME-Version: 1.0 References: <4C17EAC4.60705@morningstar2.co.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by listserv.uni-heidelberg.de id o5GCK4KK010704 Message-ID: <4C18C15C.30509@residenset.net> Date: Wed, 16 Jun 2010 14:19:40 +0200 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: =?ISO-8859-1?Q?Lars_Hellstr=F6m?= 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/Sb97LojnDtMgfETrECMLUO9erHzOJe6KyumPEzQo/v49H/ 6WH16A3hVxdb50dQBMe/GhyW+KflE2xKxwMOEKvHDWk7UqJoh2LvyLXsywjCkfM1ILLlYNfmOEMt /DqUA==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: 6341 Joseph Wright skrev: > 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. [snip] > 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). I was as confused by this as J.Fine, but it now seems clear that you've implemented a fixed point arithmetic package that possibly will become a floating point arithmetic package. > 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 That most standard libraries primarily provide a "uniform in $[0,1]$" (or some open variation of that interval) PRNG doesn't mean it is the most natural form of a PRNG. It is entirely reasonable for an l3 core PRNG to primarily produce random bits or random integers, which could then be converted to random floats if anyone asks for it; it's easier than going the other way. > 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. There are some standard floating-point arithmetic modules for MetaPost, which could perhaps provide inspiration, but on closer inspection those seem to rely on built-in primitives for logarithm and exponent (of course, one can then take a look in mp.web to see how Knuth implemented those while avoiding overflow and such, but the level of indirection is then pretty high). Two Meta*-ish operations which could well be useful in LaTeX are "Pythagorean addition" (known as hypot in the C library I think) and "Pythagorean subtraction" (given one side and the hypothenuse, find the other side). Lars Hellström