It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
avatar
kojocel: Wishbone, do you think this article might be of use to you?
avatar
Wishbone: Thanks, but I fell off completely around halfway down page 4. I never took high-level math, so when an explanation evolves into too many long equations filled with weird variables, I tend to lose track of what is going on.

Regardless, the algorithm is a beautiful shortcut, even if I don't quite understand how it works. It's also the first time I've ever seen code which intentionally interprets the bit pattern of one data type as another. I never imagined that maneuver could have any practical applications outside of possibly cryptology, but the way it is used here truly is elegant.
You know, I never thought much of high school math either until I saw it used in the real world. While this is just one interesting example of it (in the case of digital video manipulation), there are so many other things we take for granted, like coefficient of friction for our tires around curves on icy roads (and why they have speed limits) all the way to the flushing of our toilets and the physics that goes on behind plumbing.

While you don't need the high level math, it's there and it's a way to express some of the things we see in nature in a "formulaic" way.

Interpreting one bit pattern of one data type for another is not really much different than using a different base system for numbers. People usually use base ten on a daily basis, so they use the digits zero through nine. However, people who use base two, zero and one. You kind of get the picture. You can easily convert one base to another if you know the formula (which does require some mathematics).

There are a lot of elegant algorithms out there! :)
avatar
JDelekto: Interpreting one bit pattern of one data type for another is not really much different than using a different base system for numbers. People usually use base ten on a daily basis, so they use the digits zero through nine. However, people who use base two, zero and one. You kind of get the picture. You can easily convert one base to another if you know the formula (which does require some mathematics).
I see what you're saying, but I still think there's a big difference between the two scenarios. A number is a number, regardless of which base you express it in. The number doesn't change. But taking the bit pattern of a floating point number and suddenly interpreting it as an integer makes it not only a completely different number, but also a different kind of number. The creative leap involved in designing the algorithm utilizing this leaves me in awe. Whomever came up with it originally (which wasn't John Carmack, by the way) thought so far outside the box as to have been thinking inside a completely different box.

And I know math, just not high-level math. Of course, what counts as "high-level" probably varies a lot. As an example, I've been taught differential equations, but not integrals. Integrals were part of the high-level math curriculum.
Homegroup works fine for me.
avatar
Wishbone: And I know math, just not high-level math. Of course, what counts as "high-level" probably varies a lot. As an example, I've been taught differential equations, but not integrals. Integrals were part of the high-level math curriculum.
Well, you should continue learning math and physics. After all, you'll learn about things like position (when your car's in the driveway), velocity (when you're car starts moving from point A to point B), acceleration (how long it takes for your foot on the pedal to get to the velocity you want to travel), etc.
avatar
Wishbone: And I know math, just not high-level math. Of course, what counts as "high-level" probably varies a lot. As an example, I've been taught differential equations, but not integrals. Integrals were part of the high-level math curriculum.
avatar
JDelekto: Well, you should continue learning math and physics. After all, you'll learn about things like position (when your car's in the driveway), velocity (when you're car starts moving from point A to point B), acceleration (how long it takes for your foot on the pedal to get to the velocity you want to travel), etc.
Look, I'm 37. Don't explain to me what position, velocity and acceleration mean, please ;-p

I've coded gravity simulations, and I'm working on an artificial evolution project in my spare time. I'm quite "sciency".
avatar
JDelekto: Well, you should continue learning math and physics. After all, you'll learn about things like position (when your car's in the driveway), velocity (when you're car starts moving from point A to point B), acceleration (how long it takes for your foot on the pedal to get to the velocity you want to travel), etc.
avatar
Wishbone: Look, I'm 37. Don't explain to me what position, velocity and acceleration mean, please ;-p

I've coded gravity simulations, and I'm working on an artificial evolution project in my spare time. I'm quite "sciency".
My most humble apologies. :) You know more math than you care to let on. ;)
avatar
Elenarie: Some education goes a long way, but hey, who needs that when you can rage on a random forum, right?
avatar
OldFatGuy: If I wanted to get educated, I'd go back to school. When I buy a product, I expect it to work as advertised.

Oh... and bite me.
When you buy a product, you read the manual to see how it works before whining about it. Just saying.
avatar
Wishbone: Look, I'm 37. Don't explain to me what position, velocity and acceleration mean, please ;-p

I've coded gravity simulations, and I'm working on an artificial evolution project in my spare time. I'm quite "sciency".
avatar
JDelekto: My most humble apologies. :) You know more math than you care to let on. ;)
Hehe, the problem is that in my usual work, the only math I need is the most basic stuff. For most ordinary programming tasks, 5th grade math is quite sufficient, and my last pure math class was in the 12th grade, which for me was in 1995. So occasionally when I need to know something specific (like gravity equations), looking them up is easy enough, and using them in code is a breeze. There's no advanced math involved, and the code is easy enough to understand, even if I didn't remember the equations on my own. But the mathematical proof of the fast inverse square root algorithm is something else again. Understanding it requires a theoretical mathematical foundation that I simply don't possess. I understand what happens in each line of the code, but for the life of me, I cannot understand how the weird constant was calculated originally, or what its function actually is in the algorithm.
avatar
Elenarie: When you buy a product, you read the manual to see how it works before whining about it. Just saying.
Yeah, and I followed the directions VERBATIM and it didn't work. And if you google "Windows is unable to set up a homegroup on this computer" you'll get about a thousand results because it happens often. So before you start bitching about people whining without first doing their due diligence, maybe you should make sure that first they actually didn't do their due diligence. Just sayin'.

And bite me again.
Attachments:
capture.jpg (245 Kb)
Post edited May 24, 2015 by OldFatGuy
avatar
OldFatGuy: And if you google "Windows is unable to set up a homegroup on this computer" you'll get about a thousand results because it happens often.
HomeGroup is shit so don't use it. You can still setup a workgroup, disable sharing wizard and share out folders manually. BTW, that's not helping you with HomeGroup, :p
avatar
JDelekto: My most humble apologies. :) You know more math than you care to let on. ;)
avatar
Wishbone: Hehe, the problem is that in my usual work, the only math I need is the most basic stuff. For most ordinary programming tasks, 5th grade math is quite sufficient, and my last pure math class was in the 12th grade, which for me was in 1995. So occasionally when I need to know something specific (like gravity equations), looking them up is easy enough, and using them in code is a breeze. There's no advanced math involved, and the code is easy enough to understand, even if I didn't remember the equations on my own. But the mathematical proof of the fast inverse square root algorithm is something else again. Understanding it requires a theoretical mathematical foundation that I simply don't possess. I understand what happens in each line of the code, but for the life of me, I cannot understand how the weird constant was calculated originally, or what its function actually is in the algorithm.
That's pretty cool! At least you know how to teach yourself when you need it. I've recently become a fan of Coursera (they have online college courses for free) and a couple I plan on taking are Algorithms I and II. While I took a few courses on programming in general in college, I never took one specifically for Algorithms. I'm looking forward to it.