|
-
Dec 14th, 2003, 06:47 PM
#1
Square root???
Do anyone know how you are calculation the scuare root of a number just using pen and paper....??? Or even Not sure what it is called but 3root?
-
Dec 14th, 2003, 06:49 PM
#2
I guess I could use Newton Raphsons methid....but is there a formula?
-
Dec 26th, 2003, 11:05 PM
#3
Frenzied Member
There is a process which looks a bit like long division that will do square root. It is more painful than the Newton succesive approximations method (assuming that you are good at guessing a first approximation). Given a hand calculator (without built in square root), nobody would consider using the long divison-like method rather than Newton.
In elementary school they taught the dumb method. My father taught me the Newton method, which I used. This resulted in an argument with my teacher who claimed that Newton was just guess work.
I ended up being forced to use the method taught in school. On each exam and homework paper involving square root, I wrote Dumb method!!
BTW: From a logical point of view, both long division and the similar square root method are actually equivalent to an iterative method resulting is successively better approximations.
Live long & prosper.
The Dinosaur from prehistoric era prior to computers.
Eschew obfuscation!
If a billion people believe a foolish idea, it is still a foolish idea!
VB.net 2010 Express
64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.
-
Jan 17th, 2004, 02:58 PM
#4
Addicted Member
Square root???
Here is code to find a square root from quake 3. It gets close to the inverse square root of a number using newtons method so the more iterations the more accurate it is.
This website explains what this code does and how to do it by hand.
http://www.magic-software.com/Docum...InverseSqrt.pdf
code:--------------------------------------------------------------------------------
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 ****?
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;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|