sqrt not returning proper value

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

sqrt not returning proper value

1,284件の閲覧回数
Pyretta
Contributor I

double bb, cc;

bb = 16;
cc = sqrt(bb);

 

the result of CC in the Data:2 windows is the following

bb 16 double

cc -7.6513192831291111e+221 double

 

Any thoughts?

 

Also, is there a way to limit the decimal to say 6 locations?

 

Thank you

ラベル(1)
タグ(1)
0 件の賞賛
返信
2 返答(返信)

569件の閲覧回数
CompilerGuru
NXP Employee
NXP Employee

First, which chip are you targeting?

 

Things to check:

- make sure your stack is big enough.

- is the project linking the correct libraries (double format with 64 bit vs 32 bit libraries)?

- try the same snippet with a wizard generated project. Ev. increase STACKSIZE in prm (not sure if necessary, also depends on the targeted device).

 

Daniel

0 件の賞賛
返信

569件の閲覧回数
Pyretta
Contributor I

After searching around, this project I do not think was created with the PE. I saw someone said they added -Fd to the target command line arguments options and so I did that and it is now working.

 

How would I know what I would or would not need when first creating a project and then down the road, say "Hey! I need to do this but did not enable it in the PE when I first started". When I click on "processor expert" at the top, it gives me some windows that says "Project demo.mcp does not contain PE project.... do you want to add a new PE project?" and when saying yes, my code no longer compiles and it cannot locate the header files for the MC9S09LC60.

 

Is there a way I can get my current code working so that I can utilize the PE or would I have to start over again? I saw that there was another "main" after going through the steps above.

0 件の賞賛
返信