Alex Herbert created NUMBERS-213:
------------------------------------

             Summary: Selection on a sub-range silently modifies signed-zero 
data outside [fromIndex, toIndex)
                 Key: NUMBERS-213
                 URL: https://issues.apache.org/jira/browse/NUMBERS-213
             Project: Commons Numbers
          Issue Type: Bug
          Components: arrays
    Affects Versions: 1.3
            Reporter: Alex Herbert


Selection on double data counts and then removes signs from zeros within the 
range {{{}[fromIndex, toIndex){}}}. The count of negatively signed zeros are 
then restored after processing.

This begins from the start of the array and not the {{fromIndex}} position and 
can silently modify zeros outside the target range, and not restore signed 
zeros inside the range:

 
{code:java}
double[] a = {0.0, 0.0, -0.0};
int from = 1;
int to = 3;
int k = 1;
Selection.select(a, from, to, k);
// Expected: {0.0, -0.0, 0.0}
// Actual:   {-0.0, 0.0, 0.0}   <-- modifies outside [1, 3). 
                                    Inside [1, 3) has no signed zeros.{code}
Issue identified using a security scan.

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to