Assuming this is C or similar (e.g. Objective C), change: res = be / c to: res = be / (int)c Explanation: be is being promoted form int to unsigned int, according to C's type promotion rules for mixed expressions. In the process it overflows from 25 to 0xFFFFFFE7 == 4294967271 Then you get an unsigned int result of 4294967271 / 5U = 858993454U which is then being implicitly typecast back to an int (no overflow in this step as the result is in the range of both signed and unsigned 32 bit ints) By the way, the float result should be the same, within the precision limits of a float (I get 858993472.0 ). I'm surprised that you get -5.0 in this case?
Assuming this is C or similar (e.g. Objective C), change: res = be / c; to: res = be / (int)c; Explanation: be is being promoted form int to unsigned int, according to C's type promotion rules for mixed expressions. In the process it overflows from -25 to 0xFFFFFFE7 == 4294967271. Then you get an unsigned int result of 4294967271 / 5U = 858993454U, which is then being implicitly typecast back to an int (no overflow in this step as the result is in the range of both signed and unsigned 32 bit ints).
By the way, the float result should be the same, within the precision limits of a float (I get 858993472.0). I'm surprised that you get -5.0 in this case?
This is why languages with implicit type conversions are evil. If you don't want crap like this happening to you, use a language with a real strong type system, like Ada. – T.E.D.Mar 16 at 16:33 Making c an unsigned short also works if that makes more sense in context.
– aaz Mar 16 at 16:42.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.