What is a signed number?

61 Views Asked by At

When is the meaning of "signed number"?

A signed number simply means a number that is negative, correct? Sorry if this seems like a stupid question but I'm just starting to get deep into mathematics/computer science. Thanks!

1

There are 1 best solutions below

1
On BEST ANSWER

For example:

If you have an 8 bit number, there are 256 possible bit patterns, $00000000,00000001,...,11111111$.

There are two 'usual' assignments of values to these bit patterns, to be explicit I will use C types.

An unsigned integer uint_8: $00000000 \to 0$, $00000001 \to 1,..., 11111111 \to 255$.

A signed integer int_8: $00000000 \to 0$, $ 00000001 \to 1,...,0111111 \to 127$, $1000000 \to -128$,$ 10000001 \to -127,..., 11111111 \to -1$.

The two 8-bit types can represent the same number of values (256), but in the signed case, roughly half of these represent negative numbers.

In the above, the signed representation has the nice property that the 8 bit representation of a suitable negative value is the twos complement representation of the corresponding positive value.