Quote:
|
Originally Posted by Xelat
About math functions, I already find some functions:
% mod
| bit or
& bit and
and so....
server not have a sqrt function or operator...
|
~ not
lol, you really need sqrt in AI ?
- sqrt for integer values using common operands:
Code:
unsigned sqrt_newton(long l)
{
long temp, div = l;
unsigned rslt = (unsigned)l;
if (l <= 0)
return 0;
while (1)
{
temp = l / div + div;
div = temp >> 1;
div += temp & 1;
if (rslt > div)
rslt = (unsigned)div;
else
{
if (l / rslt == rslt - 1 && l % rslt == 0)
rslt--;
return rslt;
}
}
}
convert it into nasc... or try search more in google.