Need help with square root function (sqrt) on MCF52211

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Need help with square root function (sqrt) on MCF52211

1,595 次查看
jayteemo
Contributor I
I'm having problems getting the sqrt (or sqrtf) function to work properly.
My targer processor is MCF52211.  CodeWarrior version 5.7.0.

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.

I've tried using different msl libraries. 
Is there a specific library I should be using or a setting somewhere that I am missing?

Thanks.
标签 (1)
0 项奖励
回复
1 回复

792 次查看
admin
Specialist II
It would probably be easier to include the source code of the sqrt() function into your program and compile it along with other sources. I suggest you use Cephes Math Library:
http://www.netlib.org/cephes/
Each function in this library is contained in a single source file. You can simply drop it into your sources folder and compile it with your project. Some minor modifications might be necessary.

0 项奖励
回复