Different answers: two simple identical integer calculations?

Viewed 192

Below there are two scenarios where the operations are seemingly identical but produce results different by 1. I don't think I need to explain the programming, it's very simple.

The variable declarations are first, scenario 1 is 1) and 2 = 2), and the results obtained are listed last in each scenario.

Any help would be greatly appreciated.

int intWorkingNumber = 176555;

int intHundreds = 1;

int intPower = 1;

1)

int intDeductionValue = (intHundreds * 100 * pow(1000, intPower));

intWorkingNumber -= intDeductionValue;  

intWorkingNumber = 76555

2)

intWorkingNumber -= (intHundreds * 100 * pow(1000, intPower))

intWorkingNumber = 76554
1 Answers
Related