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

Matthias Boehm updated SYSTEMML-1981:
-------------------------------------
    Description: 
The following code returns the output as {{DOUBLE}} although it's supposed to 
return {{INT}}.

{code}
foo = function(Matrix[double] X, int input) return (int out) {
  out = input;
  for(i in 1:2) {
    tmp = sum(X);
    out = input + as.integer(tmp);
  }
}

X = seq(1,100);
xmax = max(X); #input of type double
y = foo(X, xmax); #auto casting
print(y);
{code}

For double to int casts, this is a minor issue but creates warnings that are 
annoying if such a function is called very often:
{code}
17/11/01 20:49:00 WARN controlprogram.ProgramBlock: Function output out has 
wrong value type: DOUBLE.
{code}

Furthermore, for boolean it even leads to compilation and runtime issues on 
arithmetic expressions.

  was:
The following code returns the output as {{DOUBLE}} although it's supposed to 
return {{INT}}.

{code}
foo = function(Matrix[double] X, int input) return (int out) {
  out = input;
  for(i in 1:2) {
    tmp = sum(X);
    out = input + as.integer(tmp);
  }
}

X = seq(1,100);
xmax = max(X); #input of type double
y = foo(X, xmax); #auto casting
print(y);
{code}

This is a minor issue but creates warnings that are annoying if such a function 
is called very often:
{{code}}
17/11/01 20:49:00 WARN controlprogram.ProgramBlock: Function output out has 
wrong value type: DOUBLE.
{{code}}


> Wrong value type propagation in function w/ auto cast of inputs
> ---------------------------------------------------------------
>
>                 Key: SYSTEMML-1981
>                 URL: https://issues.apache.org/jira/browse/SYSTEMML-1981
>             Project: SystemML
>          Issue Type: Bug
>            Reporter: Matthias Boehm
>            Priority: Minor
>
> The following code returns the output as {{DOUBLE}} although it's supposed to 
> return {{INT}}.
> {code}
> foo = function(Matrix[double] X, int input) return (int out) {
>   out = input;
>   for(i in 1:2) {
>     tmp = sum(X);
>     out = input + as.integer(tmp);
>   }
> }
> X = seq(1,100);
> xmax = max(X); #input of type double
> y = foo(X, xmax); #auto casting
> print(y);
> {code}
> For double to int casts, this is a minor issue but creates warnings that are 
> annoying if such a function is called very often:
> {code}
> 17/11/01 20:49:00 WARN controlprogram.ProgramBlock: Function output out has 
> wrong value type: DOUBLE.
> {code}
> Furthermore, for boolean it even leads to compilation and runtime issues on 
> arithmetic expressions.



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

Reply via email to