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/svnmirror/issues/155, and assigned it to
> Bruno :) (He wrote the FPU!). As I've said in the issue database, this
> looks like a rangereduction 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 fixedprecision
value of 2pi (equal to twice \c_pi_fp).
Comments welcome on the addition of sind and friends (and similarly
asind for arctrigonometric functions, newly added), and on range
reduction in radians.
Regards,
Bruno
