cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

niravshah00
Journeyman III

Is this fine - ok Solved

Hi ,

I have this equation  A^x  + B^y = C^z

Now since the value of A^x can go out of range from float can i do the  - Solvedfollowing

A^x = modulusPower(A,x);

kernel float modulusPower(float number,int exponent)
{
    //biggest prime number for 2^24.
    float N = 12582917.0f;

    float result =1.0f;
    int counter =0;
    while(counter
    {
        result =  fmod(result*number,N);
        counter++;
    }
    return result;
}

0 Likes
3 Replies
gaurav_garg
Adept I

Yes, you can call any sub-kernel from your main kernel.

0 Likes

I meant the math part like is it  ok to do power for continous mod

I know i can call a sub -kernel form my main kernel i remember u telling me this

0 Likes

Ok this has been solved

http://en.wikipedia.org/wiki/Modular_exponentiation

0 Likes