About the math function pow() running incorrectly on JN5169

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

About the math function pow() running incorrectly on JN5169

635 Views
LChll
Contributor III

A bus error occurred when I ran this line of code. Why can't this pow() function run? What should I do?Run this code above the 1216 routine

void hwLight_GammaCorrectRGB(float *R, float *G, float *B)
{
if ( *R > 0.003 ) *R = (1.22 * ( pow(*R, ( 1/1.5 ) )) - 0.040);
else *R = 0; //1.8023 * var_R;
if ( *G > 0.003) *G = (1.22 * ( pow(*G, ( 1/1.5 ) )) - 0.040);
else *G = 0; //1.8023 * var_G;
if ( *B > 0.003 ) *B = (1.09 * ( pow(*B, ( 1/1.5 ) )) - 0.050);
else *B = 0; //1.8023 * var_B;
}

ad
Labels (2)
0 Kudos
1 Reply

526 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hi Linklai, I hope you're doing well!

 

As a test, if you use the pow function with an integer power instead of to the power of 1/1.5, do you still get a bus error? I performed a test with two to the power of two, and it did not cause a bus error.

 

Please let me know of your findings.

 

Best regards,

Sebastian

0 Kudos