Adding 1 to -127 in Byte: Understanding the Result
The result of -127 + 1 is -126. This might seem counterintuitive, but it's a result of how negative numbers are represented in computers using two's complement notation.
In a byte, which has 8 bits, the most significant bit (MSB) indicates the sign. When adding 1 to -127, the result is effectively a wrap-around from the lowest negative value (-128) to the highest positive value (127).
原文地址: https://www.cveoy.top/t/topic/mYVR 著作权归作者所有。请勿转载和采集!