Search code examples
binaryunsignedsigned

What is the difference between signed and unsigned binary


I've been reading a few sites, but none of them make sense to me. Is signed and unsigned binary them same as signed and unsigned variables. I'd be glad if you could help :)


Solution

  • The "signed" indicator means that the item can hold positive or negative values. "Unsigned" doesn't distinguish between positive and negative values. A signed/unsigned variable can refer to any numerical data type (such as binary, integer, float, etc). Each data type might be further defined as signed or unsigned.

    For example, an 8-bit signed binary could hold values from 0-127, both positive and negative (1 bit is used for the sign and 7 bits for the value), while an 8-bit unsigned binary could hold values from 0-255 (nothing distinguishes whether or not the value should be considered positive or negative, though it is commonly assumed to be positive).

    A signed binary is a specific data type of a signed variable.

    Hope that helps!