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: Sun, 26 Jun 2016 17:01:45 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0

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

As for the comparison against Maple, that looks to be a double vs. long double
numerical result, no type of programming flaw.  Here is a C program you may
try, compiled with:


gcc evaluate.c -o evaluate -lm


The result I am seeing is:


sebald@ ~/octave/bug_48307 $ evaluate 
DOUBLE
M_PI = 3.141592653589793115997963468544185161590576171875
10000001/3 = 3333333.6666666665114462375640869140625
sin(pi*x)/(pi*x) =
-8.26993260956150473721458331322065049562297645024955272674560546875e-08
LONG DOUBLE
M_PIl = 3.14159265358979323851280895940618620443274267017841339111328125
10000001/3 = 3333333.666666666666742457891814410686492919921875
sin(pi*x)/(pi*x) =
-8.2699326043331140428346591282514346722860854033143596097943373024463653564453125e-08


PI doesn't come out exactly as the C define is, simply illustrating the finite
precision of the floating point.  But, the double results matche Octave--so
presumably Octave isn't doing something like computing Pi in a strange way. 
The long double result is getting closer to the Maple result.  Tell me what
you get for these values.  I'm using a Xeon processor.  I don't know details
of Xeon 128-bit math, but it sounds like while 64-bit is hardware
implementation, 128-bit might be software extension:

https://software.intel.com/en-us/articles/differences-in-floating-point-arithmetic-between-intel-xeon-processors-and-the-intel-xeon

Maybe your processor is software extension for 128-bit, and who knows if the
two methods are similar?

I've a feeling that the discrepancies you originally noted are an issue with
symbolic representation and computation.  My guess is something in Octave's
symbolic representation isn't carried out as accurately as it could be.  E.g.,
maybe it does sin(pi*x) / (pi*x) as

sin((sym) pi * (sym) 10000001 / (sym) 3) / (sym) pi * (sym) 10000001 / (sym)
3

which comes out different than expected.  Speculation right now, but in any
case, I'm inclined to think comparing against the Maple result isn't valid.

(file #37585)
    _______________________________________________________

Additional Item Attachment:

File name: evaluate.c                     Size:0 KB


    _______________________________________________________

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]