google-site-verification: googlebaca44933768a824.html Another way of Squaring? - Old Royal Hack Forum

Announcement

Collapse
No announcement yet.

Another way of Squaring?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Another way of Squaring?

    Is there another way to square root a function? Other then sqrt()? Thanks,

    S

    #2
    LookUp Tables.
    But Finally it's the same.

    -------------------

    I've been looking through the various threads on this forum about fast sqrt and inverse sqrt approximations, and have also been looking at the relevant code in the Doom 3 sdk, and have a couple of questions. 1. I understand enough about the methods used to know that it relies on the speci
    Last edited by floxy; 08-31-2009, 06:30 AM.

    i search a good source code for Dods with aimbot and other stuff i know this is the same engine as counter strike source but css hacks are not work in dods.

    Comment


      #3
      Sorry I meant Square Root* Thanks for reply though.

      Comment


        #4
        You mean another way to square a variable?


        var*var? :D

        Comment


          #5
          Originally posted by Lawgiver View Post
          You mean another way to square a variable?


          var*var? :D
          That is the reverse of a square root?

          Comment


            #6
            why do you need a different way to sqrt whats wrong with that.
            /* fibre */

            Comment


              #7
              Originally posted by entername View Post
              That is the reverse of a square root?
              hm ye youre right, i missunderstood something there.

              why do you need a different way to sqrt whats wrong with that.
              yes thats what im wondering too, you can be 99% sure that your implementation of sqrt will be slower than the one of the standard library. SO USE THE STANDARD LIBRARY.

              Comment


                #8
                Yeah, I was just asking to know if there is a better/another way to do it. Just for extra information :). Thanks for replies though. Btw I know how to Square things. I was just looking for a another way.

                Comment


                  #9
                  you could try making a binary search.

                  so your basically creating your own sqrt function
                  /* fibre */

                  Comment


                    #10
                    this is what i came up today :D

                    Code:
                    double my_sqrt( double number, int tries = 10 )
                    {
                    	double sqrt;
                    	double a1, a2;
                    	a1 = number;
                    	a2 = 1;
                    
                    	for( int i = 0; i < tries; i++ )
                    	{
                    		a1 = ( a1 + a2 ) / 2;
                    		a2 = number / a1;
                    	}
                    
                    	sqrt = ( a1 + a2 ) / 2;
                    
                    	return sqrt;
                    }
                    pretty fast i guess and it uses heron's algorythm :D

                    Math Forum - Ask Dr. Math

                    Comment

                    Working...
                    X