AnsweredAssumed Answered

Problem with "roundf" function in KDS

Question asked by Sreerama Dhanalakshmi on May 30, 2018
Latest reply on Jun 20, 2018 by Alice_Yang

We are using Kinetis design studio version 3.2 for our application. In this IDE we are facing a problem with "roundf" of math library function.(explained in below)


 float val = 14.98967;

 

 float C_val = 0;

 

 C_val = roundf(val*100)/100;                            // Round off the value with two decimal places

 

the result for the above function in Code warrior  is  C_Val = 14.9900
    
But in KDS : C_Val = 14.9899998;

 

Is there any other method in KDS to get the value same as in Code warrior ?

Please suggest...

 

Regards

Dhanalakshmi

Outcomes