Unexpected result if power type is changed to unsigned long.
I tried changing the power type to unsigned long and displaying the first 31 powers, but this had the unexpected result that the 31st power was displayed as a negative number (i.e. the variable power was being treated as long).
I found that the only way to get power treated as unsigned long was to declare the iterator i an unsigned long as well.
Why is that?
Last edited by rinpoche; March 14th, 2014 at 09:53 AM..
|