Chapter 1 - Data Representation Flashcards
Data representation
Methods used internally to represent information stored in a computer
3 main coding systems
- American Standard Coded for Information Interchange (ASCII)
- Extended Binary Coded Decimal Interchange Code (EBCDIC)
- Unicode
Binary System
- Computers are digital
- Only 2 discrete states: 0(off) or 1(on)
- Each digit is known as a bit (binary digit)
Data representation
- 8 bits -> 1 byte
- 1 byte can represent 2^8 = 256 pieces of information
- More bytes - represent numbers, characters, etc.
Data types
- Vary in
- Word length - number of bits used
- Representation
- Fixed-point - integer or long
- Floating-point - float or double
Fixed-point representation
- Used for integer or long numbers
- 3 systems to represent numbers:
- Sign-and-magnitude
- 1’s complement
- 2’s complement
Sign-and-magnitude
- leftmost bit - sign; remaining bits - magnitude
* Just change the sign bit and keep the magnitude to show the negative value
1’s complement
• Negative values - complement each bit of the corresponding positive number
2’s complement
• Negative values - do the 1’s complement first by complement each bit of the corresponding positive number. Add one to the 1’s complement.
IEEE
Institute of Electrical and Electronic Engineers
Floating-point representation
• According to the international Institute of Electrical and Electronic Engineers(IEEE), numbers are represented in the normalized form
Types of errors
- Mistakes
- Random error
- Truncation error
- Round off error
- Propagated error
Mistakes
typographical errors entered with program or maybe running the program using the wrong data etc.
Random errors
caused by random fluctuations in electronics due to for example power surges.
Truncation errors
Due to simplification of mathematics to make it easy to solve the problem