So I do not know if this is useful or not and I really don't know if it is worth anything but I read about it on the nets and decided to take a whack at it and see what happens.
Basically, an algorithm that approximates the sqrt. I have no idea if I am doing this right but here it ishttp://en.wikipedia.org/wiki/Alpha_max_plus_beta_min_algorithm
public float fastSqrt(Vector2f vec1)
float x = vec1.x*vec1.x;
float y = vec1.y*vec1.y;
if(x > y)
x = (x*.960434f)/vec1.x;
y = (y*.397825f)/vec1.y;
y = (y*.960434f)/vec1.y;
x = (x*.397825f)/vec1.x;
x *= -1;
y *= -1;
I know this is micro benchmarking which is basically useless but I found no speed improvement against Math.sqrt
I have to be doing something right as the result is only off from Math.sqrt by a little and in my particle prog there is almost no visual difference.
Anyone know something on this? I think it is a cool idea and would like to hear what other, more experienced, people have to say.