Page 1 of 1

sign and abs function problem

Posted: 21 Jan 2012 16:06
by analog604
Hello,

I think I've found a bug when the sign() and abs() functions are used in a script.

It is that each function only works with a value and not a variable.

Try it out, create global variable 'moset'
assign a monitor object to look at 'moset'
Then add one of these scripts and trigger it in any way you like:

//sign func always returns a 1 with variable i
decl x,i=2;
moset=stretch(0,11);
for(x=0;x<10;x++){
if(sign(i)==1) moset[x]=i;
i--;
}

and another:
// this sign doesn't return -1 with variable
decl x,i=3;
moset=stretch(0,11);
for(x=0;x<10;x++){
if(sign(i)==-1) moset[x]=i;
i--;
}

and now abs()
//and abs returns whatever variable i is, negative or postive:
//scripted abs broken

decl x,i=2;
moset=stretch(0,11);
for(x=0;x<10;x++){
moset[x]=abs(i);
i--;
}

Is this just me, am I doing this incorrectly?

Thanks!
J