sqrt not returning proper value

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

sqrt not returning proper value

1,070 Views
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

Labels (1)
Tags (1)
0 Kudos
2 Replies

355 Views
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 Kudos

355 Views
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 Kudos