I am having troubler with simple division. I know this might be a stupid question but here is my code:
unsigned int totalCycles;
unsigned int cycleCount;
double IPC = (double) totalCycles / cycleCount;
I then print out IPC. When IPC comes out, it is nowhere near what the value should be. For instance, if totalCycles is ~99 million and cycleCount is around 10.1 million, IPC should be around 9.8. When I print IPC, it comes out as ~2.1 billion. I tried converting the unsigned int to an int and then to a double by doing this:
double temp = (int)totalCycles;
double temp2 = (int)cycleCount;
and temp was like ~60 million and temp2 gave me a value of 0. So that did not work... any help would be great!