0

input problem

I just started to use Scilab 6.0.0 and I have the following doubt.

I am using the function "input" in two subsequent lines, as in the following script.When I run the script in console, if the values of "x" and "y" are both %pi/2, the expected answer of the program would be "Infinite", but it was not. In Scilab 5.5.2 the script run correctly. Does anybody know why?

sincerely

Julio

function zcalc() x=input("Enter the value of x:"); y=input("Enter the value of y:"); if abs(cos(y))<1D-15 then if abs(sin(x))<1D-15 then disp("Undetermined"); else disp("Infinite"); end else z=sin(x)/cos(y); disp(z,"z="); z=return(z); end endfunction

Scilab

0

Hi jsant100, here is the modified code. Please use the following command to check the output

z = zcalc(%pi/2,%pi/2)

Hope it will solve your problem

function z=zcalc(x, y) disp(x,"Value of x = ") disp(y,"Value of y = ") if ~clean(abs(cos(y))) then if ~clean(abs(sin(x))) then z = %nan else z = %inf end else z=clean(sin(x)/cos(y)); end endfunction

thank you a lot (I learned somethings with your code...).

However, my doubt is not really about the specific script, but about the possibility of using the "input" in Scilab 6.0.0.

in Scilab 5.5.2, that script was working, but in Scilab 6.0.0 not. It seems a bug with using "input" two times in the same script. E.g., in the following simple script , "y" value is asked two times and with something like a "--->" in the prompt. It would be a bug in this version?

function test()

x=input("x=");

y=input("y=");

z=x+y;

disp(z,"z=")

z=return(z)

endfunction

This simple code run ok in Scilab 5.5.2 but not in Scilab 6.0.0....

sincerely

Julio

11-08-17, 4:46 p.m.jsant10011-08-17, 5:52 p.m.ashutumhoThank you very much.

Actually, this is a bug in v6.0.0 and it was solved in branch version.

sincerely

Julio

13-08-17, 9:58 a.m.jsant100Login to add comment