AnsweredAssumed Answered

Converting from Int to float

Question asked by anze on Dec 17, 2012
Latest reply on Jan 4, 2013 by kef

Hello,

 

I have a strange behaviour in my project. I would like to receive a 32bit value via CAN and interprete it as a float value.

But the conversion to float seems to be wrong.

 

For example when I try to do the following:

 

int32_t fixTest = 0x3fc00000; //should be 1.5

float testValue = (float)fixTest;

 

In my case test Value is 1.06956e9 instead of the right value 1.5;

What am I missing here? Is something wrong with my project settings?

 

I am using Codewarrior 10.3 and MPC5643L (Leopard).

 

Thanks in advance.

Outcomes