Computer Data Formats Industrial Informatics, Production and Logistics by Wolfgang Neff.

Slides:



Advertisements
Similar presentations
ICS312 Set 2 Representation of Numbers and Characters.
Advertisements

Data Representation Computer Organization &
Data Representation COE 205
Number Systems Decimal (Base 10) Binary (Base 2) Hexadecimal (Base 16)
1 Binary Arithmetic, Subtraction The rules for binary arithmetic are: = 0, carry = = 1, carry = = 1, carry = = 0, carry =
Data Representation ICS 233
Binary and Decimal Numbers
1 Binary Numbers Again Recall that N binary digits (N bits) can represent unsigned integers from 0 to 2 N bits = 0 to 15 8 bits = 0 to bits.
IT-101 Section 001 Lecture #4 Introduction to Information Technology.
Computer Systems 1 Fundamentals of Computing
Codes and number systems Introduction to Computer Yung-Yu Chuang with slides by Nisan & Schocken ( ) and Harris & Harris (DDCA)
COMP201 Computer Systems Number Representation. Number Representation Introduction Number Systems Integer Representations Examples  Englander Chapter.
Digital Logic Chapter 2 Number Conversions Digital Systems by Tocci.
Simple Data Type Representation and conversion of numbers
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
Binary Numbers. Why Binary? Maximal distinction among values  minimal corruption from noise Imagine taking the same physical attribute of a circuit,
Computers Organization & Assembly Language
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
Computer Arithmetic Nizamettin AYDIN
Digital Design: From Gates to Intelligent Machines
EX_01.1/46 Numeric Systems. EX_01.2/46 Overview Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code,
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
Number Systems Spring Semester 2013Programming and Data Structure1.
ICS312 Set 1 Representation of Numbers and Characters.
Number Systems Decimal (Base 10) –10 digits (0,1,2,3,4,5,6,7,8,9) Binary (Base 2) –2 digits (0,1) Digits are often called bits (binary digits) Hexadecimal.
Number Systems. Today Decimal Hexadecimal Binary –Unsigned Binary –1’s Complement Binary –2’s Complement Binary.
Representation of Data Ma King Man. Reference Text Book: Volume 2 Notes: Chapter 19.
Number Systems and Codes. CS2100 Number Systems and Codes 2 NUMBER SYSTEMS & CODES Information Representations Number Systems Base Conversion Negative.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
ECE 301 – Digital Electronics Unsigned and Signed Numbers, Binary Arithmetic of Signed Numbers, and Binary Codes (Lecture #2)
The Teacher CP4 Binary and all that… CP4 Revision.
Cosc 2150: Computer Organization Chapter 2 Part 1 Integers addition and subtraction.
Number Systems Decimal (Base 10) –10 digits (0,1,2,3,4,5,6,7,8,9) Binary (Base 2) –2 digits (0,1) Digits are often called bits (binary digits) Hexadecimal.
The Teacher CP4 Binary and all that… CP4 Revision.
CISC1100: Binary Numbers Fall 2014, Dr. Zhang 1. Numeral System 2  A way for expressing numbers, using symbols in a consistent manner.  " 11 " can be.
1 Representation of Data within the Computer Oct., 1999(Revised 2001 Oct)
Number Systems and Logic Prepared by Dr P Marais (Modified by D Burford)
Computer Math CPS120: Lecture 3. Binary computers have storage units called binary digits or bits: Low Voltage = 0 High Voltage = 1 all bits have 0 or.
Data Representation, Number Systems and Base Conversions
Computer Math CPS120 Introduction to Computer Science Lecture 4.
AEEE2031 Data Representation and Numbering Systems.
Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Signed Integers The highest bit indicates the sign. 1 = negative, 0 = positive.
Number Systems Denary Base 10 Binary Base 2 Hexadecimal Base 16
Number Systems by Dr. Amin Danial Asham. References  Programmable Controllers- Theory and Implementation, 2nd Edition, L.A. Bryan and E.A. Bryan.
Chapter 1 Representing Data in a Computer. 1.1 Binary and Hexadecimal Numbers.
Data Representation COE 301 Computer Organization Dr. Muhamed Mudawar
CS 125 Lecture 3 Martin van Bommel. Overflow In 16-bit two’s complement, what happens if we add =
Lecture No. 4 Computer Logic Design. Negative Number Representation 3 Options –Sign-magnitude –One’s Complement –Two’s Complement  used in computers.
Number Systems Part 2. Counting in Binary DecimalBinary
CHAPTER 3 BINARY NUMBER SYSTEM. Computers are electronic machines which operate using binary logic. These devices use two different values to represent.
Number Systems. The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal.
Data Representation COE 301 Computer Organization Prof. Muhamed Mudawar College of Computer Sciences and Engineering King Fahd University of Petroleum.
Number Systems Decimal (Base 10) –10 digits (0,1,2,3,4,5,6,7,8,9) Binary (Base 2) –2 digits (0,1) Digits are often called bits (binary digits) Hexadecimal.
CS2100 Computer Organisation
Data Representation COE 308 Computer Architecture
Programming and Data Structure
Data Representation ICS 233
Lec 3: Data Representation
Data Representation.
Number Representation
3.1 Denary, Binary and Hexadecimal Number Systems
Data Representation Binary Numbers Binary Addition
IT 0213: INTRODUCTION TO COMPUTER ARCHITECTURE
CS1010 Programming Methodology
Data Representation COE 301 Computer Organization
Number Systems Lecture 2.
Data Representation ICS 233
Data Representation COE 308 Computer Architecture
Presentation transcript:

Computer Data Formats Industrial Informatics, Production and Logistics by Wolfgang Neff

Numeral Systems (1) Our numeral system uses 10 digits to represent all numbers. –0, 1, 2, 3, 4, 5, 6, 7, 8, 9 –base-ten numeral system The value of a digit depends on its position: positional numeral system The values of numbers have to be calculated. –2005 = 2∙ ∙ ∙10 + 5∙1 –MMV = (in contrast to above)

Numeral Systems (2) Generalisation –Base-b Numeral Systems. –Base: Number of digits –Value:

Decimal System (1) Base: 10 –base-ten numeral system Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Value of a decimal number –1001 = 1∙ ∙ ∙ ∙10 0 1∙ ∙ ∙10 + 1∙ dec

Decimal System (2) Representation of a decimal number –1001 =1001 ÷ 10= 100remainder ÷ 10= 10remainder 0 10 ÷ 10= 1remainder 0 1 ÷ 10= 0remainder dec Number range of a given number of digits –10 Number of digits –4 digits: 10 4 =  0 … 9999 ready reading direction

Binary System (1) Base: 2 –base-two numeral system Digits: 0, 1 Value of a binary number –1001 = 1∙ ∙ ∙ ∙2 0 1∙8 + 0∙4 + 0∙2 + 1∙1 9 dec

Binary System (2) Representation of a binary number –9 =9 ÷ 2= 4remainder 1 4 ÷ 2= 2remainder 0 2 ÷ 2= 1remainder 0 1 ÷ 2= 0remainder bin Number range of a fixed number of digits –2 Number of digits –4 digits: 2 4 = 16  0 … 15

Binary Numbers (1) Computers only understand two states. –Current is flowing / Current is not flowing –Switch on / Switch off These two states are denoted by –0 / 1 or H / L (H for high, L for low) All data has to be encoded by these two states. Computers use the base-two system.

Binary Numbers (2) A binary digit is called bit. Bits are grouped as a single bit contains only very little information : –4 bits: Nibble –8 bits: Byte –16 bits: Word –32 bits: Double Word

Binary Numbers (3) Bytes are used to measure storage media. To keep numbers handy binary prefixes (Kilo, Mega, Giga, Terra etc.) are used. Binary prefixes are powers of 1024 (2 10 ). –1 KByte (KB): = Bytes = 1024 Bytes –1 MByte (MB): 1024 KB = Bytes = 1,048,576 Bytes –1 GByte (GB): 1024 MB = Bytes = 1,073,741,824 Bytes –1 TBytte (TB): 1024 GB = Bytes = 1,099,511,627,776 Bytes

Binary Numbers (4) Binary Numbers are difficult to read. There- fore four of them are grouped and a new digit assigned to C D A1110E B1111F As sixteen digits are needed this code is a base-sixteen numeral system.

Binary Numbers (5) Examples –0000  0–  64 –0111  7–  7A –1010  A–  BC –FFFF  F–  FF C D A1110E B1111F

Hexadecimal System (1) Base: 16 –hex numeral system –base-sixteen numeral system Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Value of a decimal number –1001 = 1∙ ∙ ∙ ∙16 0 1∙ ∙ ∙16 + 1∙ dec

Hexadecimal System (2) Representation of a hex number –4097 =4097 ÷ 16= 256remainder ÷ 16 = 16remainder 0 16 ÷ 16= 1remainder 0 1 ÷ 16 = 0remainder hex Number range of a fixed number of digits –16 Number of digits –4 digits: 16 4 =  0 … (0 … FFFF)

Rapid Conversion Bin → Dec Write 1 above the last digit. Proceed doubling until you reach the beginning. Add all numbers where the digit below has a value of 1. Example: bin = = 179 dez

Rapid Conversion Dec → Bin Proceed doubling 1 until the result is larger than the number you want convert. Try to subtract both numbers. If it is possible the digit is 1 otherwise it is 0. Example: dez = bin

Rapid Conversion Bin ↔ Hex Conversion between bin and hex is most easily done with aid of a hex table. Every nibble can be assigned a hex digit an vice versa. HexBinHexBinHexBinHexBin C D A1010E B1011F1111

Addition (1) Addition has got two particularities. –Carries– Leading Zeros 1 st Number nd Number0512 Carry1000 Result2457 Leading Zero

Addition (2) Carry We get a carry if the result of an addition can not be expressed by a single digit (e. g. 9+5=14). It is transferred to the next position. Leading Zero Leading zeros can proceed numbers without changing their value (e. g. 0025=25). That way numbers can be filled.

Addition (3) 1 st Bit nd Bit Carry Result dec bin Adding two bytes the following situa- tions are encountered.

Addition (4) Example of a binary addition 1 st Number nd Number Carry Result

Fixed Bit Length (1) Number of digits of a binary number. The least valuable bit (rightmost) is called LSB (Least Significant Bit). The most valuable bit (leftmost) is called MSB (Most Significant Bit) Bit Number MSB (2 7 =128) LSB (2 0 =1)

Fixed Bit Length (2) Fixed bit lengths limit the number of possible values of a binary number. –8 bits: 2 8 → –16 bits: 2 16 → ,536 –32 bits: 2 32 → 0...4,294,967,296 The number of possible values is call range.

Fixed Bit Length (3) If a binary number exceeds its range an overflow occurs. Bit C st Number nd Number Carry Result The overflowed bit is called carry bit and is often discarded.

Fixed Bit Length (4) As the overflow is discarded binary numbers restart at zero if their range is exceeded. (After comes again). The number line becomes a number circle!

Negative Numbers (1) By counting beyond zero negative numbers are achieved.

Negative Numbers (2) Usually binary numbers whose MSB is set are considered negative. I. e. the MSB tags negative numbers. Example –8 th bit unset: are positive –8 th bit set: are negative –128 … 255 → -128 … -1

Negative Numbers (3) Positive values are sacrificed to achieve negative numbers. Which numbers are negative depends on the bit length. –Usually:positive:0...2 n-1 -1 negative: n-1 n:bit length

Negative Numbers (4) To get the negative of a given number use its two's complement. –Negate all bits of the number (0→1, 1→0) –Add the number 1 Number Negated Number Carry Result

Floating Point Numbers (1) Floating point numbers are a subset of the rational numbers. Floating point numbers have a distinct data type. All numbers containing a decimal point are considered floating point. Numbers without a decimal point are considered integer.

Floating Point Numbers (2) Floating Point Numbers are represented as exponential numbers. 10 to the power … is abbreviated by E. Examples: 5,05.0 · E0 3, · E , · E6 0, · E-3

Floating Point Numbers (3) The part after E is called mantissa. The part before E is called exponent. Floating point numbers are stored as: 4 th Byte3 rd Byte2 nd Byte1 st Byte SEEEEEEEEMMMMMMMMMMMMMMMMMMMMMMM SExponentMantissa Sign

Characters (1) Characters are encoded by integer numbers. There are several encoding schemes –ASCII: 7 bit encoding scheme –extended ASCII: 8 bit encoding scheme ANSI (Windows-1252) ISO Latin1 (ISO ) –Unicode: 32 bit encoding scheme

ASCII Lower Hex Digit ABCDEF Higher Hex Digit 0 NUL SOH STXETXEOFENQACKBEL BSHTLFVTFFCRSOSI 1 DLEDC1DC2DC3DC4NAKSYNETBCAN EM SUBESC FSGSRSUS 2 !"#$%&'()*+,-./ :;<=>? 5PQRSTUVWXYZ[\]^_ 6`abcdefghijklmno 7pqrstuvwxyz{|}~ DEL American Standard Code for Information Interchange: 1968

Unicode (1) ASCII is very limited. Not adequate for internationalisation. The solution is Unicode. All characters ever used should be encoded. It uses a 32 bit encoding scheme. –Variants: UTF-8, UTF-16, UTF-32

Unicode (2) Unicode is or organised in groups. –Diacritics and Ligatures à, å, ä, æ –Non-Latin writing systems Arabic: العربية Cyrillic: Кириллица –Logographic writing system Chinese: 汉语 –Special purpose characters Mathematics: ·, ×, ÷, ≈, ±, ∫, ∞

Important Expressions (1) numbering system digit range decimal system binary system hexadecimal system bit length MSB / LSB Zahlensystem Ziffer Wertebereich Dezimalsystem Binärsystem Hexadezimalsystem Bitbreite MSB / LSB

Important Expressions (2) carry leading zero overflow two's Complement floating point number character encoding scheme internationalisation (i18n) Übertrag Führende Null Überlauf Zweikomplement Gleitkommazahl Zeichen Kodierungsschema Internationalisierung