top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to optimize this math operation SQRT for speed?

+2 votes
249 views

I have some C code which is using sqrt which is using a lot of processing time. Is there a way to optimize?

posted May 4, 2015 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes
float total = (sqrt(
          ((point_A[j].length)*(point_A[j].length))+
          ((point_B[j].width)*(point_B[j].width))+
          ((point_C[j].height)*(point_C[j].height))
                                                        ));
answer Jun 11, 2015 by Shivaranjini
Similar Questions
+3 votes
int32 find_result(int64 sec)
{

    if(config == defualt_base)
    {
        uint32 H      = j * k + 1; /*(here j and k global)*/

        if((((uint32)(sec - CS - RS)) % (H * N_p * M_r))== 0) 
        {
            result = 0;
        }
    }
    else
    {
        if((((uint32)(sec - CS - RS)) % (N_p * M_r))== 0)  /*(N_p and M_r global)*/
        {
            result = 0;
        }
    }
}

This function have to be execute several times in a second, How can optimize it ? Please help me to avoid mathematical operations applying on this function?

–1 vote

The wind chill index (WCI) is calculated from the wind speed (v) in miles per hour and the temprature (t) in
fahrenheit . three formulas are used . depending on the wind speed :
if(0<=v<=4)then WCI=t
if(v>=45) then WcI =1.6t-55
otherwise , WCI=91.4 + (0.0203v - 0.304(v)^1/2 - 0.474)

write a program that prompt the user to insert the wind speed (v) in miles per hour format and prompt the user to insert wind temprature on fehrenhite then calculate the wind chill index

+2 votes

Can Anyone write the C program without using Arthimethic operators for Math table?

...