Google Answers Logo
View Question
 
Q: computer arithmetic ( Answered,   0 Comments )
Question  
Subject: computer arithmetic
Category: Computers > Hardware
Asked by: john1000-ga
List Price: $2.00
Posted: 14 Sep 2002 17:34 PDT
Expires: 14 Oct 2002 17:34 PDT
Question ID: 65119
If an integer number is stored using one byte, what range of decimal
numbers can be represented by this?
Answer  
Subject: Re: computer arithmetic
Answered By: websearcher-ga on 14 Sep 2002 17:46 PDT
 
Hi john1000:

A single byte integer can store a range of 256 integer values.
Typically, the exact range represented is 0 through 255, or [0, 255].

The reason for this? A byte has 8 bits, or eight signals, each having
one of two values, either 0 or 1. Therefore, a byte can have:

2^8 = 256 different values. 

Sometimes, single byte values are used to represent *signed* integers,
meaning the range [-128,127].

The following comes from a page about the computer language FORTRAN:

"The standard trick in FORTRAN for reading unsigned data is to read
each datum value into a signed integer of the same size and then copy
numbers into the next bigger size INTEGER or REAL. Most negative
numbers are stored as twos-complement these days so the conversion
consists of adding the appropriate offset. For byte data that would be
2^8 i.e. 256, for 2 byte data it's 2^16 i.e. 65536, and for 4 bytes
data it's 2^32 (whatever that is). If you know that none of the data
values are greater than half the largest possible value then no
conversion is necessary. For example the largest possible unsigned
byte value is 255. If you know that all of the data is less than or
equal to 127 then no conversion (other than ICHAR) is needed."
From: http://cires.colorado.edu/~knowlesk/programming/fortranio.html

There is an excellent little Powerpoint presentation on this that you
can view using your browser:

"Integer Types"
http://www.cis.upenn.edu/~matuszek/cit591/Slides/numbers.ppt

I hope this answers you question. 

Thank you. 

websearcher-ga

Clarification of Answer by websearcher-ga on 14 Sep 2002 18:04 PDT
Search Strategy:

one byte integer
://www.google.com/search?hl=en&ie=ISO-8859-1&q=one+byte+integer
Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy