Need help with square root function (sqrt) on MCF52211

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Need help with square root function (sqrt) on MCF52211

1,604件の閲覧回数
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 返信

801件の閲覧回数
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 件の賞賛
返信