Hi,

When using the ARM_SE simulator, the following program prints out 19:

#include <stdio.h>
int main() {
  int a = 50;
  a = a / 7;
  printf("The Result is %d \n", a);
  return 0;
}

However, I would expect it to be 7.

Any ideas why this is happening?

If I modify the fourth line as follows:

  a = (float)a / 7;
  a = a / (float)7;
  a = (float)a / (float)7;

Then it works.

Thanks

David

-- 
David R White
Research Student
Dept. of Computer Science
University of York, 
Heslington, YO10 5DD

_______________________________________________
m5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/m5-users

Reply via email to