Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

Cast from float to int (TMS320C24xx ANSI C Compiler, Version 7.04)

$
0
0

For the following code

  float x = -32768.0f;
  int   x_i   = (int) x;
  long  x_l_1 = (int) x;
  long  x_l_2 = (long) x;
  long  x_l_3 = (int) -32768.0f;

compiled with TMS320C24xx ANSI C Compiler, Version 7.04 I get on a TMS320LF2407A the following results (in the watch window from CCS3.3):

x:        -32768.0  
x_l_3:    -32768
x_i:      -29186  
x_l_1:    167422
x_l_2:    -32768 

The values of x_i and x_l_1 are unexpected. Can someone please comment on this?

Regards

Johannes


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>