Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
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.