block



Hi

I have a batch file :

***** start code *****
zMin:0.0;
zMax:3.0;
iMax:10;
ER:2.0;
/*   */
LastIteration(z,ER,iMax):=
block
(
i:0,
loop,
z:z*z,
i:i+1,
if ((z<ER) and(i<iMax))  then go(loop),
return(i)
);
/*  */
plot2d([z,LastIteration(z,ER,iMax)],[z,zMin,zMax],[y,0,11]);

********** end code *****************************

For values  0<z<=1 function should give iMax.
For z>1 it should give integer values < iMax.
Like : http://commons.wikimedia.org/wiki/Image:Data.png
But it does not.
When I remove codition (z<ER) function gives iMax for all values, so i 
is incremented properly.
I have read thread : "Conditional inside a block not working"
and doc but I still can't find the error in my code

Adam