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?
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
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