You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@systemml.apache.org by "Matthias Boehm (JIRA)" <ji...@apache.org> on 2016/05/08 01:43:12 UTC
[jira] [Commented] (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:comment-tabpanel&focusedCommentId=15275446#comment-15275446 ]
Matthias Boehm commented on SYSTEMML-656:
-----------------------------------------
it's the other way around: TRUE+TRUE == 2.0 is correct (in order to maintain consistency with R); we need to fix the language-level handling of TRUE+TRUE to proper arithmetic.
> 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)