Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Overflow of byte

 
Robert Ziel
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
can someone explain to me when a byte flows over
it turns negative .. ???
thanks,
Robert
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Robert,
A byte is an 8 bit integer data type. The possible range of the value of a byte is -128 to 127. Let's consider adding one to the bit representation of the maximum value of 127:

Now, mosey on over to The JavaRanch Campfire and learn all about Cat and Mouse Games with Bits!
Good Luck.
 
Corey McGlone
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dirk, it looks like your binary addition could use a little help.

Just wanted to clear that up.
Corey
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, it was early in the morning. You should have seen the first draft - it was worse.
Thanks Corey.
 
Robert Ziel
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys,
this clears it up...
Robert
 
Danger, 10,000 volts, very electic .... tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!