LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Bruno Le Floch <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Tue, 5 Nov 2013 02:44:55 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (32 lines)
Hello Andrew,

On 10/4/13, Joseph Wright <[log in to unmask]> 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).

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

ATOM RSS1 RSS2