[arm-gnu] an long long problem
zzzh.2007
zzzh.2007 at qq.com
Thu Mar 22 16:13:09 UTC 2012
Hi, all,
I am using sourcery_g++_lite_for_arm_eabi ( version of arm-2008q3-66-arm-none-eabi) in Contiki to do some programming, and below is my code that have problem:
-----------------------------------------------
short a,x;
long long y;
a = (short)rand();
x = (short)rand() *10000/66536;
y = a*x*x;
printf( "a and x are %d, %d \n", a, x);
printf( " y is: %lld \n", y);
----------------------------------------------
The problem is: the y result is always wrong.
I have no idea why this is happening, any help?
Zhu
2012-03-22
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/arm-gnu/attachments/20120323/c2a9c01f/attachment.html>
More information about the arm-gnu
mailing list