octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #48307] sinc loses precision for large argumen


From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #48307] sinc loses precision for large arguments
Date: Mon, 27 Jun 2016 07:12:13 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0

Follow-up Comment #7, bug #48307 (project octave):

I experimented with modulo arithmetic, but with 2*pi and the sin() function. 
Didn't work so well.  Maybe this kind of approach works better with the base
being an exact floating point number, i.e., 2.  This result looks a little
better:

>> x = double(10000001)/3
x =    3.3333e+06
>> sprintf("%0.100g", sin(pi*mod(x,2))/(pi*x))
ans =
-8.26993260666192699379488145923489117450344565440900623798370361328125e-08

but still not near the same as the Maple 128-bit result or the gcc/gnu C
128-bit result.

In any case, even if this is a good solution for sinc() (we need to test), it
doesn't fix anything for sin() (and probably other trig functions).  It is
really the library where this needs to be improved.

It seems to me one needs to go back to the series computation (Taylor,
Maclaurin) and use something other than expansion about 0 so that some
convergence criteria can be used.  The plots in this paper:

http://pages.pacificcoast.net/~cazelais/187/maclaurin-sin.pdf

illustrate how more terms are required as x becomes large.  And no doubt any
discrepancies in the numeric representation of large numbers adds to the
inaccuracy.

Should we start digging through the library code?

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?48307>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]