Square Root Function

Square Root Function

Returns the square root of an integer number (24 bit). Returns result as a float

float sqrt(unsigned short long x){
    // sqrt function returns square root
    unsigned short long a,b,c;  //24 bit
    unsigned char i;
    float result;
   
    c=x;
    a=63;                       //seed estimate of root
    b=63;
    for(i=0;i<8;i++){
        a=c/a;   
        a=(a+b)/2;
        b=a;
    }
    result=(float)a;
    return(result+0.001);       //Make sure result is never zero
}

Shopping Cart
0 items
 
DELIVERY/PAYMENT

Free Delivery Orders over £50

UK - £2.40 orders under £50
Airmail from £2.95 (+VAT)
More Details...

 
Brands
 
 Check out our videos
Follow us on:
acebook