Hello all:

 

Has anyone ever had issues with type casting?  I’m using soft-float to compile for the gumsitx and weird things are happening when I cast from unsigned int to float. 

 

I’m getting data from a serial port casting that data into floats.  The following works fine (example):

 

Unsigned int num1, num2;

 

Num3 = (float)num1;

Printf(num3);

 

But when I do the following, my “data” gets corrupted:

 

Num3 = (float)num1;

Num4 = (float)num2;

Printf(num3);

Printf(num4);

 

Note:  It’s the data from the serial port that becomes corrupted (bits turned on and off, consistently!)

I’m sure it’s not the way I’m reading the data.  I can print out the bytes in the stream:  first case stream is correct, second case stream is corrupted

 

Sorry for the lack of details, but this problem is too weird…

 

Regards,

 

Nghiem Do