Unsigned vs Signed byte numbers

  • Thread starter ckaiser813
  • Start date
  • Tags
    Numbers
In summary, signed byte numbers can represent both positive and negative values, while unsigned byte numbers can only represent positive values. They are stored in memory using two's complement notation and straight binary notation, respectively. The range of values that can be represented by signed and unsigned byte numbers is -128 to 127 and 0 to 255, respectively. The choice between signed and unsigned byte numbers in programming languages depends on the need for representing negative values and efficiency in operations.
  • #1
ckaiser813
14
0
some one tell me if this is right

this is the binary number 11111111

unsigned = 255 (decimal)

signed = -1 (decimal)

is this correct because in my book it says to take the opposite so all 1's become 0's then you add 1 in the LSD.
 
Physics news on Phys.org
  • #2
Assuming the machine uses twos complement - yes
 
  • #3
yeah it is thanks for the help
 

What is the difference between signed and unsigned byte numbers?

Signed byte numbers can represent both positive and negative values, while unsigned byte numbers can only represent positive values.

How are signed and unsigned byte numbers stored in memory?

Signed byte numbers are stored in memory using two's complement notation, while unsigned byte numbers are stored using straight binary notation.

What is the range of values that can be represented by signed and unsigned byte numbers?

Signed byte numbers have a range of -128 to 127, while unsigned byte numbers have a range of 0 to 255.

Why do some programming languages use signed byte numbers while others use unsigned byte numbers?

Some programming languages use signed byte numbers because they allow for the representation of both positive and negative values, while others use unsigned byte numbers because they are more efficient for certain operations.

How do I know whether to use signed or unsigned byte numbers in my code?

The decision to use signed or unsigned byte numbers depends on the specific needs of your program. If you need to represent negative values, then signed byte numbers are the appropriate choice. If your program only deals with positive values, then unsigned byte numbers may be a better option for efficiency.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
2K
Replies
4
Views
927
  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
2K
Back
Top