Tumblelog by Soup.io
Newer posts are loading.
You are at the newest post.
Click here to check if anything new just came in.

May 26 2015

bigbasti
12:28
bigbasti
12:24
2770 f2ad
Reposted fromkjuik kjuik viasstefania sstefania

May 22 2015

bigbasti
19:34
0250 9d32
Reposted fromdeusexmachina deusexmachina viateijakool teijakool
19:34
8241 57b5 500
Reposted fromkimik kimik viaSchubi Schubi
bigbasti
19:20
1571 a752
bigbasti
19:20
bigbasti
19:12
5246 a3e9 500
Reposted fromfungi fungi viataw taw
bigbasti
19:12
6859 eaf7
Reposted fromRockYourMind RockYourMind viaDowdles Dowdles
bigbasti
19:03

May 19 2015

bigbasti
20:56
Reposted fromlokrund2015 lokrund2015 vialinse linse
bigbasti
20:51
Reposted frommondomg mondomg viasosna sosna
bigbasti
20:49
bigbasti
20:19
3775 70a8
Reposted fromNeutrum Neutrum viaawezone awezone
bigbasti
20:11

The following code is the fast inverse square root implementation from Quake III Arena, stripped of C preprocessor directives, but including the exact original comment text:[4]

float Q_rsqrt( float number )
{
	long i;
	float x2, y;
	const float threehalfs = 1.5F;
 
	x2 = number * 0.5F;
	y  = number;
	i  = * ( long * ) &y;                       // evil floating point bit level hacking
	i  = 0x5f3759df - ( i >> 1 );               // what the fuck? 
	y  = * ( float * ) &i;
	y  = y * ( threehalfs - ( x2 * y * y ) );   // 1st iteration
//      y  = y * ( threehalfs - ( x2 * y * y ) );   // 2nd iteration, this can be removed
 
	return y;
}

In order to determine the inverse square root, an approximation for x^{-1/2} would be determined by the software, then some numerical method would revise that approximation until it came within an acceptable error range of the actual result. Common software methods in the early 1990s drew a first approximation from a lookup table.[5] This bit of code proved faster than table lookups and approximately four times faster than regular floating point division.[6] Some loss of precision occurred, but was offset by the significant gains in performance.[7] The algorithm was designed with the IEEE 754-1985 32-bit floating point specification in mind, but investigation from Chris Lomont and later Charles McEniry showed that it could be implemented in other floating point specifications.

The advantages in speed offered by the fast inverse square root kludge came from treating the longword[note 1] containing the floating point number as an integer then subtracting it from a specific constant, 0x5f3759df. The purpose of the constant is not immediately clear to someone viewing the code, so, like other such constants found in code, it is often called a "magic number".[1][8][9][10] This integer subtraction and bit shift results in a longword which when treated as a floating point number is a rough approximation for the inverse square root of the input number. One iteration of Newton's method is performed to gain some precision, and the code is finished. The algorithm generates reasonably accurate results using a unique first approximation for Newton's method; however, it is much slower and less accurate than using the SSE instruction rsqrtss on x86 processors also released in 1999

Fast inverse square root - Wikipedia, the free encyclopedia
Reposted fromg33ky g33ky viaRK RK
20:05
2196 ba9a 500
Reposted fromLittleJack LittleJack viaawezone awezone
bigbasti
20:04
2209 b909
Reposted fromoopsiak oopsiak viabrandstaetter brandstaetter
20:00
2792 43c3 500
bigbasti
19:55
bigbasti
19:54
Reposted fromNaitlisz Naitlisz
bigbasti
19:53
8077 d9b2 500
Reposted fromHaujobb Haujobb viafastjack fastjack
Older posts are this way If this message doesn't go away, click anywhere on the page to continue loading posts.
Could not load more posts
Maybe Soup is currently being updated? I'll try again automatically in a few seconds...
Just a second, loading more posts...
You've reached the end.