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

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

[Octave-bug-tracker] [bug #56414] sin function incorrect results when no


From: Kevin Anderson
Subject: [Octave-bug-tracker] [bug #56414] sin function incorrect results when not slicing input
Date: Wed, 29 May 2019 10:30:43 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36

URL:
  <https://savannah.gnu.org/bugs/?56414>

                 Summary: sin function incorrect results when not slicing
input
                 Project: GNU Octave
            Submitted by: kandersondax
            Submitted on: Wed 29 May 2019 02:30:42 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 5.1.0
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

The "sin" function can be made to have different output in very specific
circumstances depending on if an input vector is sliced or not.  Slicing to
copy actually gives the correct result, whereas the original (or a simple
copy) does not.

Here is a minimal example from Octave 5.1.0 on Windows 10 x64:


>> x = -30:-20
x =

  -30  -29  -28  -27  -26  -25  -24  -23  -22  -21  -20

>> sin(pi*x)
ans =

 Columns 1 through 9:

   1.0779e-14  -1.4209e-14   1.7640e-14  -6.8592e-15   1.0289e-14  -1.3720e-14
  2.9391e-15  -6.3693e-15   9.7996e-15

 Columns 10 and 11:

  -1.3230e-14   2.4492e-15

>> sin(pi*x(1:end))
ans =

 Columns 1 through 9:

   1.0779e-14   1.3553e-18   3.4289e-15  -6.8592e-15  -3.9215e-15   4.9120e-16
  2.9391e-15  -6.3693e-15   9.7996e-15

 Columns 10 and 11:

   9.8104e-16   2.4492e-15




As can be seen above, the results from columns 5, 6, and 10 differ.  The
results from the x(1:end) set are correct if you type in the numbers
individually.  The results from the first form where x is used directly are
incorrect.  It is also only certain values this happens with, though the
example above is not all of them.

The multiplication by "pi" also seems necessary for this bug to occur, but I
cannot guarantee that.  I only know I've only seen it with "pi" as a factor. 
This bug was also observed when multiplying by a number which was a multiple
of pi as well.




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?56414>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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