sqrt

From ZDoom Wiki

Jump to: navigation, search
function int sqrt (int x)
{
	int r;
	x = x + 1 >> 1;
	while (x > r)
		x -= r++;
	return r;
}

Square roots are nice for things like the Pythagorean theorem which allow you to find the distance between objects. The function is not built into ACS so here's one that works fine.

Retrieved from "http://zdoom.org/wiki/Sqrt"
Personal tools