Advertisement

something to explain

Started by January 03, 2001 12:07 PM
0 comments, last by Dave007 24 years ago
Hi! I need to explain this code. It''s taken from glVelocity fast code library. But I don''t understand anything of this. It might do rational sqrt. Thnx for help.

__inline float RSqrt(float number)
{
	long i;
	float x2, y;
	const float threehalfs = 1.5f;

	x2 = number * 0.5f;
	y  = number;
	i  = * (long *) &y						i  = 0x5f3759df - (i >> 1);             
	y  = * (float *) &i
	y  = y * (threehalfs - (x2 * y * y));   

	return y;
}
 
Dave007 dave007@volny.cz
--------Dave[ Math Studio ] A Computer Algebra System
What''s the difference between a square root & a rational square root?
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

This topic is closed to new replies.

Advertisement