Results 1 to 3 of 3

Thread: How to get square root for longlong type value

  1. #1
    Junior Member
    Join Date
    Nov 2004
    Location
    Russia
    Posts
    3

    How to get square root for longlong type value

    Hi!

    I have a problem with calculating the vector's length. I use __sqrtx() from uglu.c and when I pass value greater then 2^32 (fixed limit) the function returns an undefined result. I have expanded type of passed value from GLfixed to __int64 but it has not helped. __sqrtx() uses Newton's method and does 6 compute iterations. May be it is not enough. I think I need more compute iterations, right? May be somebody can suggest any idea to help me resolve this problem. I will be very grateful.

  2. #2
    Junior Member
    Join Date
    Feb 2005
    Posts
    1

    Re: How to get square root for longlong type value

    Why you don't use your own sqrtx function. If you prefer the Newton Approximation then something like this:
    Code :
     

    Hope this helps....
    Cheers Tobi

    [ February 18, 2005: Message edited by: tobi ]

  3. #3
    Senior Member
    Join Date
    Sep 2003
    Location
    Seattle, WA
    Posts
    246

    Re: How to get square root for longlong type value

    You could also just scale your input value before calling into the function; divide by 4 in the input corresponds to divide by 2 in the output.

    - HM

Similar Threads

  1. Traversing a Tree using the root pointer
    By preston in forum OpenCL
    Replies: 13
    Last Post: 02-11-2011, 11:06 AM
  2. Drawing a Square vs Loading a Square
    By krammark23 in forum OpenGL ES 1.X - fixed function hardware
    Replies: 3
    Last Post: 11-04-2008, 10:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •