Slashdot Mirror


Origin of Quake3's Fast InvSqrt()

geo writes "Beyond3D.com's Ryszard Sommefeldt dons his seersucker hunting jacket and meerschaum pipe to take on his secret identity as graphics code sleuth extraordinaire. In today's thrilling installment, the origins of one of the more famous snippets of graphics code in recent years is under the microscope — Quake3's Fast InvSqrt(), which has been known to cause strong geeks to go wobbly in the knees while contemplating its simple beauty and power." From the article: ""

27 of 402 comments (clear)

  1. A famous quote by ArchieBunker · · Score: 5, Funny

    "English motherfucker, do you speak it?" Anyone care to explain what that function does?

    --
    Only the State obtains its revenue by coercion. - Murray Rothbard
    1. Re:A famous quote by Trigun · · Score: 5, Funny

      But faster!

    2. Re:A famous quote by mogrify · · Score: 5, Funny

      (x^(1/2))^2 != 1

      Interesting smiley... is that a dead man with a fraction in his mouth and a prominent Adam's Apple, wearing a bow tie and a dress and standing on a toy race car?

      What's your point, man?

      --
      perl -e 'foreach(values %SIG){$_="IGNORE";}while(){}'
    3. Re:A famous quote by Fred_A · · Score: 2, Funny

      I think this is a hoax. I've been playing Quake 3 extensively and I haven't once seen anything reflected off any object. What's more it was all very slow. Granted this might have been because of my Tseng ET4000 (which I'm planning on upgrading eventually). Although I did set it to CGA to make things snappier.

      Anyway I'm not convinced.

      --

      May contain traces of nut.
      Made from the freshest electrons.
    4. Re:A famous quote by Overly+Critical+Guy · · Score: 2, Funny

      Are you sure you're not actually running Doom 3? Not only does no light reflect off of anything, but no light is emitted in the first place.

      --
      "Sufferin' succotash."
    5. Re:A famous quote by ebyrob · · Score: 3, Funny

      If this doesn't make your head swim:

      int i = *(int*)&x;
      i = 0x5f3759df - (i >> 1);


      Then I'm afraid the whole article is going to be lost on you...

      We've got a floating point being operated on as an integer.
      We've got a mysterious constant.
      We've got a two's complement sign-flip combined with a bit-shift.

      The only thing missing from this party is hookers and beer.

    6. Re:A famous quote by Bullet-Dodger · · Score: 2, Funny

      But it comes with a free Frogurt!

    7. Re:A famous quote by Directrix1 · · Score: 2, Funny

      The Frogurt is also cursed.

      --
      Occam's razor is the blind faith in the natural selection of least resistance and in universal oversimplification. -- EF
  2. I know who wrote it by circletimessquare · · Score: 4, Funny

    I have a truly marvelous proof of who wrote this code which this comment box is too narrow to contain.

    --
    intellectual property law is philosophically incoherent. it is your moral duty to ignore it or sabotage it
  3. Re:And so why do we care? by From+A+Far+Away+Land · · Score: 4, Funny

    " Fast InvSqrt(), which has been known to cause strong geeks to go wobbly in the knees "

    I was a little worried when Slashdot posted the Britney Spears beaver pictures, but they now have their credibility back as the home of "News for Nerds".

  4. Obviously SCO's intellectual property! by gukin · · Score: 4, Funny

    Anyone who has ever played a computer game should pay up.

  5. Re:And so why do we care? by Anonymous Coward · · Score: 5, Funny

    Britney Spears beaver pictures Link please.

  6. Re:And so why do we care? by gstoddart · · Score: 2, Funny

    I was a little worried when Slashdot posted the Britney Spears beaver pictures

    Hmmmm ... why can't we dupe stories like that more often? :-P
    --
    Lost at C:>. Found at C.
  7. Old and busted: Duff's device by Stavr0 · · Score: 3, Funny
    New hotness: Fast InvSqrt()

    Naah, just kidding. They both deserve a spot in the Clever Hacks Hall of Fame

  8. Hmm... by porkmusket · · Score: 2, Funny

    Suddenly I'm very scared that Ballmer will want to InvSqrt me some pictures of his kids.

    1. Re:Hmm... by gstoddart · · Score: 2, Funny
      Suddenly I'm very scared that Ballmer will want to InvSqrt me some pictures of his kids.

      Ummmm .... you mean, squirt his kids back to him? :-P
      --
      Lost at C:>. Found at C.
  9. Re:And so why do we care? by Pollardito · · Score: 4, Funny
    The pic links are all over - check at foobies.com or similar.

    However, if it really did get posted to /., I'd like a link so I can read the comments...
    i imagine it'd be all sorts of variations of "what's that?", "it might be a tribble", and "it's like a wookie, but smaller"
  10. InvSquirt!?-Sperm. by Anonymous Coward · · Score: 1, Funny

    Nope. It's when it goes in instead of out.

  11. It Was Obviously... by eno2001 · · Score: 3, Funny

    ...the work of John Romero. Apparently he was going to call it the MakeYouMyBitch() function. ;P

    --
    -"...bad old ideas look confusingly fresh when they are packaged as technology" - Jaron Lanier (Digital Maoism on Edge.o
    1. Re:It Was Obviously... by Chris+Burke · · Score: 4, Funny

      He calls every function that. Have you seen his code? Freaking unreadable.

      int MakeYouMyBitch7 () {
          int my_bitch = MakeYouMyBitch() * MakeYouMyBitch2();
          return MakeYouMyBitch36(my_bitch);
      }

      Just terrible.

      --

      The enemies of Democracy are
  12. Re:This paper seems to have the info by Toasty16 · · Score: 4, Funny

    Ohhhhhh, now I get it... [Looks furtively around to see if anyone knows he doesn't get it]

  13. Re:Poor function name by truedfx · · Score: 3, Funny
    x^(-1/2) != x^(2).
    Er... no. It's entirely possible for x^(-1/2) and x^(2) to be equal. This happens when x=1. (I know what you meant, but what you posted is very different.)
  14. Error! by jrmiller84 · · Score: 3, Funny

    float InvSqrt(float x) { float xhalf = 0.5f*x; int i = *(int*) i = 0x5f3759df - (i >> 1); x = *(float*) x = x*(1.5f - xhalf*x*x); return x; } Asking John whether it was him or Michael returned a "not quite". But it's supposed to return a float!

    --
    I will forever be a student.
  15. Re:And so why do we care? by JabberWokky · · Score: 4, Funny
    Clearly you haven't seen the pictures. It looks much more like a Deltan.

    --
    Evan

    --
    "$30 for the One True Ring. $10 each additional ring!" -- JRR "Bob" Tolkien
  16. Alternate mod type by JBHarris · · Score: 2, Funny

    I wish there was an option to mod some of these posts "+1 Whoa".

  17. Re:It may in part be related to something I did .. by tknd · · Score: 3, Funny

    (I'm (sorry))

    You don't (happen to (program (lisp))) do you?

  18. Re:It might be damn smart.. by exp(pi*sqrt(163)) · · Score: 2, Funny

    Yeah, the computing industry is full of people who resent smart programmers who don't program by the book. That's fine. Every programmer eventually finds their own level and there's no shortage of startup businesses who need web page designers.

    --
    Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.