Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by h1439878.stratoserver.net (8.14.2/8.14.2/Debian-2build1) with ESMTP id rA7M1foM015814 for ; Thu, 7 Nov 2013 23:01:42 +0100 Received: from relay2.uni-heidelberg.de ([129.206.210.211]) by mx-ha.gmx.net (mxgmx111) with ESMTPS (Nemesis) id 0MWPG2-1V8Cvt1oug-00XYCO for ; Thu, 07 Nov 2013 23:01:35 +0100 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 rA7Lw4Aq028599 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 7 Nov 2013 22:58:04 +0100 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [127.0.0.1]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id rA7F00kH024926; Thu, 7 Nov 2013 22:58:04 +0100 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 10531539 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Thu, 7 Nov 2013 22:58:04 +0100 Received: from relay2.uni-heidelberg.de (relay2.uni-heidelberg.de [129.206.210.211]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id rA7Lw3hP009574 for ; Thu, 7 Nov 2013 22:58:03 +0100 Received: from mail-qa0-f54.google.com (mail-qa0-f54.google.com [209.85.216.54]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id rA7Lvt31028526 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for ; Thu, 7 Nov 2013 22:57:58 +0100 Received: by mail-qa0-f54.google.com with SMTP id j7so1005237qaq.13 for ; Thu, 07 Nov 2013 13:57:55 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.49.72.164 with SMTP id e4mr17054213qev.36.1383861474959; Thu, 07 Nov 2013 13:57:54 -0800 (PST) Received: by 10.96.166.65 with HTTP; Thu, 7 Nov 2013 13:57:54 -0800 (PST) References: <524E7349.4030306@clear.net.nz> <524F0DA5.4040106@morningstar2.co.uk> <5278AEAA.2020103@clear.net.nz> Content-Type: text/plain; charset=ISO-8859-7 X-MIME-Autoconverted: from quoted-printable to 8bit by listserv.uni-heidelberg.de id rA7Lw3hP009575 Message-ID: Date: Thu, 7 Nov 2013 22:57:54 +0100 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Bruno Le Floch Subject: Re: Bug in l3fp for sines near 2pi To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: <5278AEAA.2020103@clear.net.nz> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by relay2.uni-heidelberg.de id rA7Lw4Aq028599 Envelope-To: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=V3; X-GMX-Antivirus: 0 (no virus found) X-UI-Filterresults: notjunk:1;V01:K0:ug0rwXvoO/o=:g5zXN0GiRw5ySWWzy6PbRuSucC xOgWxe7djKEwx8k7ybWVUu2VbnRjVezjhFBDGFHL0YumwbrYunUZTcEOs6wK/EAkooK2m2Wk6 dguq7nWA+k2BEgrOEmsAkxOL56I2BFu/GAkBIIfxlpZJPV0D6fMVKrJl1m4JUbQ0CLLsibonM xP7DscWSmvdZdU0UTX7nNQ5aKuc3UjXHMAGVFSGDrlvCTIqmLKllT9gF2ErrTWmQDDJXzBuhM LQI5QVqIHdhE4kIx/JTA5EMC4btNKP4QHtCnj87q/hakS+dBV5LTiAo97MZjb/FNNAcsnbnWf ikIj963XCLabOqeehHbNUeAylRhF5oS5xottLYsmX2+BDYS/l18ElOeSDanTB9P2EXpWpVuZW pReWncS1xhXqQMvh1K2lsxDa2MarK200Zi+Q3SJjyWiGWtTPPVGVt3b+qmf6VB5hRtlX+S/IW T2sfKZbMppzasjR1w0cDDldR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yfIxoDt7u4//WLkX07jTcFFbgv9wSBoVDCHwBt X-UI-Loop:V01:PeI1vmC5KdY=:zrAuiWEGh/V6enKOcAZG/r9ODatlvZzz9HxJXyWm/LM= Status: R X-Status: X-Keywords: X-UID: 7312 >> For the functions in radians, I would need >> to either store EMAX+16 decimals of pi, where EMAX is the maximal >> exponent and 16 is the precision of floating point numbers, or be able >> to compute them. Right now, I am cheating, using a fixed-precision >> value of 2pi (equal to twice \c_pi_fp). >> > > "fixed precision" makes me think of the LaTeX2e package fp, 18 places > before and after the decimal point. In using it I became alarmed at how > rapidly errors propagated inwards when exponents were involved. Indeed, sin(1e99) is currently completely wrong, as 1e99 is reduced modulo 6.283185307179588 rather than 2=F0. It appears that many not-too-serious math libraries do this (with slightly more precise values of 2=F0). The approach does not cause too much trouble, as identities such as sin(a+b)=3Dsin(a)cos(b)+sin(b)cos(a) are preserved. Essentially, what it does is to stretch (or shrink) trigonometric functions so that they have a period equal to 6.283185307179588 rather than 2=F0. I don't like this very much, so I will be looking into how to do proper argument reduction. >> Comments welcome on the addition of sind and friends (and similarly >> asind for arc-trigonometric functions, newly added), and on range >> reduction in radians. > > sind etc, and the inverse functions, are very welcome. (But as a studen= t > of hyperbolic geometry, I especially look forward to the hyperbolic > functions and inverses!) Is this a jest, or would you actually use those functions? Hyperbolic functions are not too hard, now that I have added a few tools to manipulate extended precision numbers (basically, they're just a bunch of sums and products on the result of the exponential function). Their inverses are more tricky, and I can't promise them any time soon. Regards, Bruno