Uploaded image for project: 'SystemDS'
  1. SystemDS
  2. SYSTEMDS-1981

Wrong value type propagation in function w/ auto cast of inputs

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • SystemML 1.0.0
    • None
    • None

    Description

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

      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);
      

      For double to int casts, this is a minor issue but creates warnings that are annoying if such a function is called very often:

      17/11/01 20:49:00 WARN controlprogram.ProgramBlock: Function output out has wrong value type: DOUBLE.
      

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

      Attachments

        Activity

          People

            mboehm7 Matthias Boehm
            mboehm7 Matthias Boehm
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: