You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@systemml.apache.org by "Deron Eriksson (JIRA)" <ji...@apache.org> on 2016/05/03 00:52:12 UTC

[jira] [Updated] (SYSTEMML-656) Read-in boolean variable math treated as doubles rather than booleans

     [ https://issues.apache.org/jira/browse/SYSTEMML-656?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Deron Eriksson updated SYSTEMML-656:
------------------------------------
    Description: 
If we have two boolean variables and add them normally, the addition is treated as boolean algebra (true + true = true).
{code}
x = TRUE;
y = TRUE;
z = x + y;
print(x);
print(y);
print(z);
{code}
produces
{code}
TRUE
TRUE
TRUE
{code}

However, if we read in boolean scalars using the read statement and add the boolean variables, the math ends up giving a double result instead of a boolean result:
{code}
x = read("./tmp/sc1", data_type="scalar", value_type="boolean");
y = read("./tmp/sc2", data_type="scalar", value_type="boolean");
z = x + y;
print(x);
print(y);
print(z);
{code}
This produces (where ./tmp/sc1 contains "TRUE" and ./tmp/sc2 contains "TRUE"):
{code}
TRUE
TRUE
2.0
{code}

  was:
If we have two boolean variables and add them normally, the addition is treated as boolean algebra (true + true = true).
{code}
x = TRUE;
y = TRUE;
z = x + y;
print(x);
print(y);
print(z);
{code}
produces
{code}
TRUE
TRUE
TRUE
{code}

However, if we read in boolean scalars using the read statement and add the boolean variables, the math ends up giving a double result instead of a boolean result:
{code}
x = read("./tmp/sc1", data_type="scalar", value_type="boolean");
y = read("./tmp/sc2", data_type="scalar", value_type="boolean");
z = x + y;
print(x);
print(y);
print(z);
{code}
produces (where ./tmp/sc1 contains "TRUE" and ./tmp/sc2 contains "TRUE"):
{code}
TRUE
TRUE
2.0
{code}


> Read-in boolean variable math treated as doubles rather than booleans
> ---------------------------------------------------------------------
>
>                 Key: SYSTEMML-656
>                 URL: https://issues.apache.org/jira/browse/SYSTEMML-656
>             Project: SystemML
>          Issue Type: Bug
>            Reporter: Deron Eriksson
>
> If we have two boolean variables and add them normally, the addition is treated as boolean algebra (true + true = true).
> {code}
> x = TRUE;
> y = TRUE;
> z = x + y;
> print(x);
> print(y);
> print(z);
> {code}
> produces
> {code}
> TRUE
> TRUE
> TRUE
> {code}
> However, if we read in boolean scalars using the read statement and add the boolean variables, the math ends up giving a double result instead of a boolean result:
> {code}
> x = read("./tmp/sc1", data_type="scalar", value_type="boolean");
> y = read("./tmp/sc2", data_type="scalar", value_type="boolean");
> z = x + y;
> print(x);
> print(y);
> print(z);
> {code}
> This produces (where ./tmp/sc1 contains "TRUE" and ./tmp/sc2 contains "TRUE"):
> {code}
> TRUE
> TRUE
> 2.0
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)