Justin Morton

Help with sqrt (square root function): Target MCF52211, CW ver 5.7.0

Discussion created by Justin Morton on May 8, 2008
Latest reply on May 14, 2008 by Tom Thompson

I'm having problems getting the sqrt (or sqrtf) function to work properly.
My targer processor is MCF52211.  CodeWarrior version 5.7.0.
I've included the following libraries in the project: C_4i_CF_MSL.a and fp_coldfire.a
Also, <math.h> is included in the source.

When I build with the Require Function Prototypes box un-checked under Language Settings -> C/C++ Language the project builds and runs with the following results:
When I run using sqrt, the result is always 20.0 and and the exception handler is entered, resulting in the error: "Access Error: Error on operand write".
When I run using sqrtf, the result is a very large, incorrect number.
When I build with the Require Function Prototypes box un-checked under Language Settings -> C/C++ Language the project fails to build with the error (referencing the sqrt function):
Error   : function has no prototype
Is there a specific library I should be using or a setting somewhere that I am missing?

Thanks.

Outcomes