Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Mine
Friday, June 23rd, 2006 at 11:53:30am UTC 

  1. float spx_sqrtf(float arg)
  2. {
  3.         if(arg==1.0) return 1.0;
  4. }
  5.  
  6. spx_word32_t spx_sqrt(spx_word32_t x)
  7. {
  8.    //printf("SQRT:%d",x);
  9.    int k=0;
  10.    spx_word32_t rt;
  11.  
  12.    if (x==0){
  13.      //printf("=%d\n",0);
  14.      return 0;
  15.    }
  16. #if 1
  17.    if (x>16777216)
  18.    {
  19.       x>>=10;
  20.       k+=5;
  21.    }
  22.    if (x>1048576)
  23.    {
  24.       x>>=6;
  25.       k+=3;
  26.    }
  27.    if (x>262144)
  28.    {
  29.       x>>=4;
  30.       k+=2;
  31.    }
  32.    if (x>32768)
  33.    {
  34.       x>>=2;
  35.       k+=1;
  36.    }
  37.    if (x>16384)
  38.    {
  39.       x>>=2;
  40.       k+=1;
  41.    }
  42. #else
  43.    while (x>16384)
  44.    {
  45.       x>>=2;
  46.       k++;
  47.       }
  48. #endif
  49.    while (x<4096)
  50.    {
  51.       x<<=2;
  52.       k--;
  53.    }
  54.    rt = ADD16(C0, MULT16_16_Q14(x, ADD16(C1, MULT16_16_Q14(x, ADD16(C2, MULT16_16_Q14(x, (C3)))))));
  55.    if (k>0)
  56.       rt <<= k;
  57.    else
  58.       rt >>= -k;
  59.    rt >>=7;
  60.    //printf("=%d\n",rt);
  61.    return rt;
  62. }

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right
worth-right
worth-right