Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by h1439878.stratoserver.net (8.14.2/8.14.2/Debian-2build1) with ESMTP id rA58gnoO006877 for ; Tue, 5 Nov 2013 09:42:50 +0100 Received: from relay.uni-heidelberg.de ([129.206.100.212]) by mx-ha.gmx.net (mxgmx003) with ESMTPS (Nemesis) id 0LeRiP-1VycVq3KMn-00q6oA for ; Tue, 05 Nov 2013 09:42:43 +0100 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 rA58dlNm020342 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 5 Nov 2013 09:39:47 +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 rA4N13R0010258; Tue, 5 Nov 2013 09:39:43 +0100 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 10522753 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Tue, 5 Nov 2013 09:39:43 +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 rA58dh8A009559 for ; Tue, 5 Nov 2013 09:39:43 +0100 Received: from smtp4.clear.net.nz (smtp4.clear.net.nz [203.97.37.64]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id rA58dCYf008361 for ; Tue, 5 Nov 2013 09:39:17 +0100 Received: from mxin3-orange.clear.net.nz (lb2-srcnat.clear.net.nz [203.97.32.237]) by smtp4.clear.net.nz (CLEAR Net Mail) with ESMTP id <0MVS006E18179Z50@smtp4.clear.net.nz> for LATEX-L@listserv.uni-heidelberg.de; Tue, 05 Nov 2013 21:39:10 +1300 (NZDT) Received: from unknown (HELO [127.0.0.1]) ([203.167.164.82]) by smtpin3.clear.net.nz with ESMTP; Tue, 05 Nov 2013 21:39:08 +1300 MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit X-Antivirus: avast! (VPS 131104-3, 05/11/2013), Outbound message X-Antivirus-Status: Clean References: <524E7349.4030306@clear.net.nz> <524F0DA5.4040106@morningstar2.co.uk> User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 Message-ID: <5278AEAA.2020103@clear.net.nz> Date: Tue, 5 Nov 2013 21:39:06 +1300 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Andrew Parsloe Subject: Re: Bug in l3fp for sines near 2pi To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: 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:ZpuwuoCtkTE=:MTbKzTssBNz2lE4hbd+oqiF8ZD tfZ2b4m7hwsAnehry2I3v//GM8uRz6QWJpOb7q4sXkHoUBz67qleHuoOGChOCDJAVhnMCsfB9 ovmb7n2vOXcKlbzl4knPfj47Yxgpw4TtY7PlJhFLTqhc8lY4ut/Ijjmcd63YiqncgL2LmHRss 9HjNxewf78NwtmGKe4AesOVRna6J5ym6osgAddGcbMRIb75wM9jGTQz8CeMH7NVH7ERTPwSBI 6HKEazJHqST81T++3VIW2akWNyDEXJHELXHkcqQgvo09BdUvTp+wS97mKCfxEUjIkew/L48lJ X8ggt1ZD7fU8oozN+wEE8njW3kqjBBuP9knr1RwhjIMF4MlgFRwnILoNBJhvY0EANIUxz0rQ/ /CrgH9P9uBFgpGa/InAmIDWSmCjepkKMTtE6M81UtNiSBMRz1dFaUl+cKGjtexubhh7LUN1lA cYmvy0/NKdu5F8ST8Filvr5VFBrQ+mIvBrApbK86X/ZQ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fLNAIgzdfnetzV99ie1HLqrcopJnZSZql5m0S X-UI-Loop:V01:9cRLNdTAFXs=:WlgZMcYcshxSd9iJZvyPau0z08m/nDTw8cw27u1XT/c= Status: R X-Status: X-Keywords: X-UID: 7311 On 5/11/2013 2:44 p.m., Bruno Le Floch wrote: > Hello Andrew, > > On 10/4/13, Joseph Wright wrote: >> On 04/10/2013 08:50, Andrew Parsloe wrote: >>> \fp_eval:n { sin( 2pi - .0001 ) } ==> 9999.999000000002 >> >> Thanks for the bug report: I've logged it as >> https://github.com/latex3/svn-mirror/issues/155, and assigned it to >> Bruno :-) (He wrote the FPU!). As I've said in the issue database, this >> looks like a range-reduction failure to me. Range reduction is known to >> be 'hard', so that's not that surprising. > > Thank you for reporting the bug (now fixed), which led me to > reconsider the implementation of trigonometric functions. I ended up > adding trigonometric functions expecting their argument in degrees > (sind, cosd, tand, cotd, secd, cscd),for which range reduction is > almost trivial, as we want to reduce modulo rational numbers > (integers, even!) rather than an irrational number. The result of > sind, cosd, etc. can thus be guaranteed to lie within 0.6 ulp of the > correct sine, cosine, etc. 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. > Comments welcome on the addition of sind and friends (and similarly > asind for arc-trigonometric functions, newly added), and on range > reduction in radians. > > Regards, > Bruno > sind etc, and the inverse functions, are very welcome. (But as a student of hyperbolic geometry, I especially look forward to the hyperbolic functions and inverses!) Andrew