SBAA588 April 2024 LM73 , LM75B , LM95071 , TMP100 , TMP101 , TMP102 , TMP103 , TMP104 , TMP107 , TMP1075 , TMP108 , TMP112 , TMP114 , TMP116 , TMP117 , TMP121 , TMP122 , TMP123 , TMP124 , TMP126 , TMP144 , TMP175 , TMP1826 , TMP1827 , TMP275 , TMP400 , TMP401 , TMP411 , TMP421 , TMP422 , TMP423 , TMP431 , TMP432 , TMP435 , TMP451 , TMP461 , TMP464 , TMP468 , TMP4718 , TMP75 , TMP75B , TMP75C
Binary | Signed Value | Unsigned Value |
---|---|---|
0b100 | -4 | 4 |
0b101 | -3 | 5 |
0b110 | -2 | 6 |
0b111 | -1 | 7 |
0b000 | 0 | 0 |
0b001 | 1 | 1 |
0b010 | 2 | 2 |
0b011 | 3 | 3 |
This table provides the full range of values in a 3-bit 2's complement number. The low bit count enables us to easily see all the possible values and observe common traits in 2's Complement encoding.
Here are some facts about 2's complement to keep in mind:
In the following abbreviated table, we can see the same traits apply to an 8-bit 2's Complement encoding. Note that the column Signed Value describes the 8-bit C data type int8_t and the column Unsigned Value describes the 8-bit C data type uint8_t.
Binary | Hex | Signed Value | Unsigned Value |
---|---|---|---|
0b10000000 | 0x80 | -128 | 128 |
0b10000001 | 0x81 | -127 | 129 |
... | ... | ... | ... |
0b11111101 | 0xFD | -3 | 253 |
0b11111110 | 0xFE | -2 | 254 |
0b11111111 | 0xFF | -1 | 255 |
0b00000000 | 0x00 | 0 | 0 |
0b00000001 | 0x01 | 1 | 1 |
0b00000010 | 0x02 | 2 | 2 |
... | ... | ... | ... |
0b01111110 | 0x7E | 126 | 126 |
0b01111111 | 0x7F | 127 | 127 |