7 ms·
Isn't (32 bit) INT_MAX 2^31-1 and INT_MIN -2^31, so this is an acceptable solution (since the decimal average is -0.5)?
by slymon99 4y ago
Isn't (32 bit) INT_MAX 2^31-1 and INT_MIN -2^31, so this is an acceptable solution (since the decimal average is -0.5)?
- pksadiq 4y ago> since the decimal average is -0.5 The C standard says: When integers are divided, the result of the / operator is the algebraic quotient with any fractional part discarded (This is often called ‘‘truncation toward zero’’). So it should be 0 (as per C standard, not sure what C++ standard says)
- a1369209993 4y agoThe question is midpoint, not division, so that's irrelevant in the first place, and even if were division, the standard is wrong.