Deron Eriksson created SYSTEMML-1816:
----------------------------------------

             Summary: toString can return -0
                 Key: SYSTEMML-1816
                 URL: https://issues.apache.org/jira/browse/SYSTEMML-1816
             Project: SystemML
          Issue Type: Bug
          Components: Runtime
            Reporter: Deron Eriksson


When display matrix values with toString, -0 can be displayed.

Example:
{code}
m = matrix("50 99 100 200",rows=2,cols=2);
x = 100;
m = (m - x) * ((m-x) >= 0)
print(toString(m))
{code}
gives:
{code}
-0.000 -0.000
0.000 100.000
{code}

Using as.scalar on the individual cells returns 0:
{code}
for (i in 1:nrow(m)) {
    for (j in 1:ncol(m)) {
        n = m[i,j]
        print('[' + i + ',' + j + ']:' + as.scalar(n))
    }
}
{code}
gives:
{code}
[1,1]:0.0
[1,2]:0.0
[2,1]:0.0
[2,2]:100.0
{code}




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to