<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Magical Square Root Implementation In Quake III</title>
	<atom:link href="http://www.codemaestro.com/reviews/9/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codemaestro.com/reviews/9</link>
	<description>The Coding Experience</description>
	<pubDate>Thu, 18 Mar 2010 08:28:59 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: wobbleing soup</title>
		<link>http://www.codemaestro.com/reviews/9#comment-33515</link>
		<dc:creator>wobbleing soup</dc:creator>
		<pubDate>Mon, 01 Mar 2010 22:27:19 +0000</pubDate>
		<guid isPermaLink="false">http://beta.codemaestro.com/?p=9#comment-33515</guid>
		<description>&lt;strong&gt;CodeMaestro » Magical Square Root Implementation In Quake III...&lt;/strong&gt;

...</description>
		<content:encoded><![CDATA[<p><strong>CodeMaestro » Magical Square Root Implementation In Quake III&#8230;</strong></p>
<p>&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arioch</title>
		<link>http://www.codemaestro.com/reviews/9#comment-33108</link>
		<dc:creator>Arioch</dc:creator>
		<pubDate>Tue, 22 Dec 2009 11:23:17 +0000</pubDate>
		<guid isPermaLink="false">http://beta.codemaestro.com/?p=9#comment-33108</guid>
		<description>Maybe. But you'd have a chance of mistake between 4-bytes, 8-bytes and 10-bytes float types. You would not have shift-right "&#62;&#62;" operation no more. And subtraction would have very different meaning and probably a bit less of speed. Also you don't have straight-forward way to specify each and very bits of the number in float form.

Though i'd prefer C++ way of doing this:
int&#38; i = &#038;f;

Since it is bit-hackery in levels deeper than assembler, then little trick of "treat this as integer" is much more important than replacing blackmagic integer constant with anothe blackmagic human-unreadable float one.</description>
		<content:encoded><![CDATA[<p>Maybe. But you&#8217;d have a chance of mistake between 4-bytes, 8-bytes and 10-bytes float types. You would not have shift-right &#8220;&gt;&gt;&#8221; operation no more. And subtraction would have very different meaning and probably a bit less of speed. Also you don&#8217;t have straight-forward way to specify each and very bits of the number in float form.</p>
<p>Though i&#8217;d prefer C++ way of doing this:<br />
int&amp; i = &#038;f;</p>
<p>Since it is bit-hackery in levels deeper than assembler, then little trick of &#8220;treat this as integer&#8221; is much more important than replacing blackmagic integer constant with anothe blackmagic human-unreadable float one.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pete</title>
		<link>http://www.codemaestro.com/reviews/9#comment-32803</link>
		<dc:creator>pete</dc:creator>
		<pubDate>Wed, 18 Nov 2009 15:24:16 +0000</pubDate>
		<guid isPermaLink="false">http://beta.codemaestro.com/?p=9#comment-32803</guid>
		<description>I remember reading an article where somebody tried to track this down, it wasn't Carmack who created it, apparently it was on some 3dfx SDK, but they were unable to pin it down. Probably one of the programmers who did the bring up for those early 3D cards.</description>
		<content:encoded><![CDATA[<p>I remember reading an article where somebody tried to track this down, it wasn&#8217;t Carmack who created it, apparently it was on some 3dfx SDK, but they were unable to pin it down. Probably one of the programmers who did the bring up for those early 3D cards.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Paterson</title>
		<link>http://www.codemaestro.com/reviews/9#comment-32628</link>
		<dc:creator>Brian Paterson</dc:creator>
		<pubDate>Mon, 26 Oct 2009 23:37:06 +0000</pubDate>
		<guid isPermaLink="false">http://beta.codemaestro.com/?p=9#comment-32628</guid>
		<description>In a word - no.
Notice the (i &#62;&#62; 1) indicates that a bit shifting operation is in play and unless you're into messy...

Here's the equivalent float for you to play with:
13211836172961054000

(evil chuckle)</description>
		<content:encoded><![CDATA[<p>In a word - no.<br />
Notice the (i &gt;&gt; 1) indicates that a bit shifting operation is in play and unless you&#8217;re into messy&#8230;</p>
<p>Here&#8217;s the equivalent float for you to play with:<br />
13211836172961054000</p>
<p>(evil chuckle)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Reiners</title>
		<link>http://www.codemaestro.com/reviews/9#comment-29076</link>
		<dc:creator>Paul Reiners</dc:creator>
		<pubDate>Fri, 29 May 2009 19:19:46 +0000</pubDate>
		<guid isPermaLink="false">http://beta.codemaestro.com/?p=9#comment-29076</guid>
		<description>What I don’t understand is what those long/float casts do: 

  i  = * ( long * ) &#038;y;  // evil floating point bit level hacking
  i  = 0x5f3759df - ( i &#62;&#62; 1 ); // what the fuck?
  y  = * ( float * ) &#038;i;
 
Is there a float value you could use in place of the integer value 0x5f3759df  (without doing the casts) that would give you the same result (albeit not as quickly)?</description>
		<content:encoded><![CDATA[<p>What I don’t understand is what those long/float casts do: </p>
<p>  i  = * ( long * ) &#038;y;  // evil floating point bit level hacking<br />
  i  = 0&#215;5f3759df - ( i &gt;&gt; 1 ); // what the fuck?<br />
  y  = * ( float * ) &#038;i;</p>
<p>Is there a float value you could use in place of the integer value 0&#215;5f3759df  (without doing the casts) that would give you the same result (albeit not as quickly)?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PNGout : Ramin Hossaini (blog)</title>
		<link>http://www.codemaestro.com/reviews/9#comment-6525</link>
		<dc:creator>PNGout : Ramin Hossaini (blog)</dc:creator>
		<pubDate>Thu, 10 Apr 2008 22:45:05 +0000</pubDate>
		<guid isPermaLink="false">http://beta.codemaestro.com/?p=9#comment-6525</guid>
		<description>[...] For those who don&#8217;t know, Ken Silverman is the programmer that created the game-engine for Duke Nukem 3D. Silverman received lots of praise from John Carmack - which says a lot because Carmack is co-founder of ID Software and lead developer for games like Doom and Quake (he also wrote what is likely the fastest inverse-square-root function, but that&#8217;s a topic for another day). [...]</description>
		<content:encoded><![CDATA[<p>[...] For those who don&#8217;t know, Ken Silverman is the programmer that created the game-engine for Duke Nukem 3D. Silverman received lots of praise from John Carmack - which says a lot because Carmack is co-founder of ID Software and lead developer for games like Doom and Quake (he also wrote what is likely the fastest inverse-square-root function, but that&#8217;s a topic for another day). [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Those old C bit tricks &#124; Oh Null!</title>
		<link>http://www.codemaestro.com/reviews/9#comment-2964</link>
		<dc:creator>Those old C bit tricks &#124; Oh Null!</dc:creator>
		<pubDate>Wed, 05 Mar 2008 01:34:26 +0000</pubDate>
		<guid isPermaLink="false">http://beta.codemaestro.com/?p=9#comment-2964</guid>
		<description>[...] After spending a lot of years writing C code it is sometimes hard to get some of those "tricks" out of your mind. The thing I always felt about C was it seemed to encourage you figure out or use cool tricks. Couple that with graphics coding you can get some strange stuff like the infamous 0×5f3759df q_sqrt function. Even though some of them are fairly worthless in modern computing, they are fun to look at and think about why they work! [...]</description>
		<content:encoded><![CDATA[<p>[...] After spending a lot of years writing C code it is sometimes hard to get some of those &#8220;tricks&#8221; out of your mind. The thing I always felt about C was it seemed to encourage you figure out or use cool tricks. Couple that with graphics coding you can get some strange stuff like the infamous 0×5f3759df q_sqrt function. Even though some of them are fairly worthless in modern computing, they are fun to look at and think about why they work! [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ATOzTOA</title>
		<link>http://www.codemaestro.com/reviews/9#comment-2046</link>
		<dc:creator>ATOzTOA</dc:creator>
		<pubDate>Tue, 05 Feb 2008 09:26:31 +0000</pubDate>
		<guid isPermaLink="false">http://beta.codemaestro.com/?p=9#comment-2046</guid>
		<description>What the ???

Why can't someone ask Carmack how he conjured the magic number :)

And why isn't Newton's Approximation used in common mathematics?</description>
		<content:encoded><![CDATA[<p>What the ???</p>
<p>Why can&#8217;t someone ask Carmack how he conjured the magic number :)</p>
<p>And why isn&#8217;t Newton&#8217;s Approximation used in common mathematics?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cornell CS 322 - Intro to Scientific Computing &#187; Blog Archive &#187; Quake3&#8217;s fast invSqrt()</title>
		<link>http://www.codemaestro.com/reviews/9#comment-1918</link>
		<dc:creator>Cornell CS 322 - Intro to Scientific Computing &#187; Blog Archive &#187; Quake3&#8217;s fast invSqrt()</dc:creator>
		<pubDate>Wed, 30 Jan 2008 04:01:27 +0000</pubDate>
		<guid isPermaLink="false">http://beta.codemaestro.com/?p=9#comment-1918</guid>
		<description>[...] CodeMaestro: Magical Square Root Implementation in Quake III [...]</description>
		<content:encoded><![CDATA[<p>[...] CodeMaestro: Magical Square Root Implementation in Quake III [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Graeme E. Smith</title>
		<link>http://www.codemaestro.com/reviews/9#comment-179</link>
		<dc:creator>Graeme E. Smith</dc:creator>
		<pubDate>Fri, 23 Nov 2007 10:26:57 +0000</pubDate>
		<guid isPermaLink="false">http://beta.codemaestro.com/?p=9#comment-179</guid>
		<description>Is anyone aware of a double precision implementation?  Presumably the magic number at the heart of the speed-up would need to be different.</description>
		<content:encoded><![CDATA[<p>Is anyone aware of a double precision implementation?  Presumably the magic number at the heart of the speed-up would need to be different.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
