Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 A Brief History of InvSqrt
Index -> General Discussion
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
matt271




PostPosted: Wed Mar 28, 2012 5:16 pm   Post subject: A Brief History of InvSqrt

Just finished my Honours Thesis about the fast InvSqrt function found in Quake III,

c:
float Q_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));
//  y = y * (threehalfs - (x2 * y * y));

    return y;
}


http://eggroll.unbsj.ca/rsqrt/

Questions, comments, suggestions?
Sponsor
Sponsor
Sponsor
sponsor
Dreadnought




PostPosted: Wed Mar 28, 2012 6:22 pm   Post subject: Re: A Brief History of InvSqrt

Wow, that's so amazing! It's probably the coolest (and weirdest) function I've ever seen.

Nice job, on the thesis too, it was fun to read.

Btw, if you plan on printing from that pdf, some of the numbers in the appendix run off the page.
matt271




PostPosted: Wed Mar 28, 2012 6:41 pm   Post subject: Re: A Brief History of InvSqrt

Thanks for the tip! I will fix it before I give print outs to my readers tomorrow!
matt271




PostPosted: Wed Sep 11, 2013 9:38 pm   Post subject: RE:A Brief History of InvSqrt

Complete version, for anybody who's interested...

http://shelfflag.com/rsqrt.pdf
Display posts from previous:   
   Index -> General Discussion
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: