sqrt not returning proper value

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

sqrt not returning proper value

1,087 次查看
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 回复数

372 次查看
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 项奖励

372 次查看
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 项奖励