Introduction to Informatics

Similar documents
Objectives. Connecting with Computer Science 2

MACHINE LEVEL REPRESENTATION OF DATA

COMP2121: Microprocessors and Interfacing. Number Systems

Beyond Base 10: Non-decimal Based Number Systems

Homework 1 graded and returned in class today. Solutions posted online. Request regrades by next class period. Question 10 treated as extra credit

Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers

Inf2C - Computer Systems Lecture 2 Data Representation

Number Systems Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. Indian Institute of Technology Kharagpur Number Representation

Course Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation

Digital Fundamentals. CHAPTER 2 Number Systems, Operations, and Codes

9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation

Beyond Base 10: Non-decimal Based Number Systems

Digital Computers and Machine Representation of Data

Digital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer.

Chapter 2. Data Representation in Computer Systems

Number Systems and Binary Arithmetic. Quantitative Analysis II Professor Bob Orr

1.1. INTRODUCTION 1.2. NUMBER SYSTEMS

Data Representation 1

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

Digital Fundamentals

Standard 11. Lesson 9. Introduction to C++( Up to Operators) 2. List any two benefits of learning C++?(Any two points)

BINARY SYSTEM. Binary system is used in digital systems because it is:

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

CHW 261: Logic Design

Basic data types. Building blocks of computation

CMPS 10 Introduction to Computer Science Lecture Notes

IT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1

Announcement. (CSC-3501) Lecture 3 (22 Jan 2008) Today, 1 st homework will be uploaded at our class website. Seung-Jong Park (Jay)

Digital Systems COE 202. Digital Logic Design. Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals

Lecture 2: Number Systems

Digital Fundamentals

COMP Overview of Tutorial #2

Module 2: Computer Arithmetic

Positional notation Ch Conversions between Decimal and Binary. /continued. Binary to Decimal

CSC201, SECTION 002, Fall 2000: Homework Assignment #2

Thus needs to be a consistent method of representing negative numbers in binary computer arithmetic operations.

Chapter 4: Computer Codes. In this chapter you will learn about:

The type of all data used in a C++ program must be specified

Number Systems CHAPTER Positional Number Systems

Final Labs and Tutors

Data Representation COE 301. Computer Organization Prof. Muhamed Mudawar

Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2

Number Systems & Encoding

Computer Organization and Assembly Language. Lab Session 4

umber Systems bit nibble byte word binary decimal

UNIT 7A Data Representation: Numbers and Text. Digital Data

Chapter 2 Exercises and Answers

CS 101: Computer Programming and Utilization

Introduction to Computers and Programming. Numeric Values

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

Floating-point Arithmetic. where you sum up the integer to the left of the decimal point and the fraction to the right.

ECE2049-E18 Lecture 6 Notes 1. ECE2049: Embedded Computing in Engineering Design E Term Lecture #6: Exam Review

CS-201 Introduction to Programming with Java

DATA REPRESENTATION. By- Neha Tyagi PGT CS KV 5 Jaipur II Shift, Jaipur Region. Based on CBSE curriculum Class 11. Neha Tyagi, KV 5 Jaipur II Shift

Internal Data Representation

Variable and Data Type I

Number Systems II MA1S1. Tristan McLoughlin. November 30, 2013

Review: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements

Using sticks to count was a great idea for its time. And using symbols instead of real sticks was much better.

Fundamentals of Programming (C)

Introduction to Scientific Computing Lecture 1

ECOM 2325 Computer Organization and Assembly Language. Instructor: Ruba A.Salamah INTRODUCTION

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Bits and Bytes and Numbers

Characters, Strings, and Floats

Chapter 3: Arithmetic for Computers

Logic and Computer Design Fundamentals. Chapter 1 Digital Computers and Information

CPS 104 Computer Organization and Programming Lecture-2 : Data representations,

CS 121 Digital Logic Design. Chapter 1. Teacher Assistant. Hadeel Al-Ateeq

Number Systems. Decimal numbers. Binary numbers. Chapter 1 <1> 8's column. 1000's column. 2's column. 4's column

COSC 243. Data Representation 3. Lecture 3 - Data Representation 3 1. COSC 243 (Computer Architecture)

Computer Organization

Divide: Paper & Pencil

CSE 1320 INTERMEDIATE PROGRAMMING - OVERVIEW AND DATA TYPES

Numeral Systems. -Numeral System -Positional systems -Decimal -Binary -Octal. Subjects:

M1 Computers and Data

LAB WORK NO. 2 THE INTERNAL DATA REPRESENTATION

IBM 370 Basic Data Types

Year 10 OCR GCSE Computer Science (9-1)

Dec Hex Bin ORG ; ZERO. Introduction To Computing

Number representations

Electronic Data and Instructions

Lecture (01) Digital Systems and Binary Numbers By: Dr. Ahmed ElShafee

LING 388: Computers and Language. Lecture 5

COMP2611: Computer Organization. Data Representation

UNIT 2 NUMBER SYSTEM AND PROGRAMMING LANGUAGES

Number codes nibble byte word double word

Chapter 2 Number Systems and Codes Dr. Xu

Binary. Hexadecimal BINARY CODED DECIMAL

Review of Number Systems

Topic Notes: Bits and Bytes and Numbers

Level ISA3: Information Representation

l l l l l l l Base 2; each digit is 0 or 1 l Each bit in place i has value 2 i l Binary representation is used in computers

CS321. Introduction to Numerical Methods

The type of all data used in a C (or C++) program must be specified

TOPICS. Other Number Systems. Other Number Systems 9/9/2017. Octal Hexadecimal Number conversion

Data Representation and Binary Arithmetic. Lecture 2

St. Benedict s High School. Computing Science. Software Design & Development. (Part 2 Computer Architecture) National 5

COE 202- Digital Logic. Number Systems II. Dr. Abdulaziz Y. Barnawi COE Department KFUPM. January 23, Abdulaziz Barnawi. COE 202 Logic Design

Exercises Software Development I. 03 Data Representation. Data types, range of values, internal format, literals. October 22nd, 2014

3 Data Storage 3.1. Foundations of Computer Science Cengage Learning

Transcription:

Introduction to Informatics Lecture : Encoding Numbers (Part II)

Readings until now Lecture notes Posted online @ http://informatics.indiana.edu/rocha/i The Nature of Information Technology Modeling the World @ infoport From course package Von Baeyer, H.C. [24]. Information: The New Language of Science. Harvard University Press. Chapters, 4 (pages -2) From Andy Clark s book "Natural-Born Cyborgs Chapters 2 and 6 (pages 9-67) From Irv Englander s book The Architecture of Computer Hardware and Systems Software Chapter 3: Data Formats (pp. 7-86)

Assignment Situation Labs Past Lab : Blogs Closed (Friday, January 9): Grades Posted Lab 2: Basic HTML Closed (Wednesday, January 3): Grades Posted Lab 3: Advanced HTML: Cascading Style Sheets Closed (Friday, February 2): Grades Posted Lab 4: More HTML and CSS Closed (Friday, February 9): being graded Lab 5: Introduction to Operating Systems: Unix Due Friday, February 6 Next: Lab 6 More Unix and FTP Due Friday, February 23 Assignments Individual First installment Closed: February 9: Being Graded Group Project First installment Presented: February 2, Due: March 9th Midterm Exam March st (Thursday)

Individual assignment Individual Project st installment The Black Box Presented: February st Due: February 9 th 2 nd Installment Presented: February 5 th Due: March: 2n d 3 rd Installment Presented: March 8 th Due: March 3th 4 th Installment Presented: April 5 th Due: April 2th

The Modeling Relation Symbols (Images) Initial Conditions Model Formal Rules Logical Consequence of Model Predicted Result???? Observed Result (syntax) (Pragmatics) Encoding (Semantics) Measure Measure World Physical Laws World 2 Hertz Modeling Paradigm

Encoding in the Modeling Relation Encoding (Semantics) Data (Symbols) Measure How to encode data? What is data? Information without context and knowledge Part of Syntax Keeping Numbers The most fundamental need for modeling and information World

Counting with the Binary System Positional number system the value of each digit is determined by its position is different from The lowest place value is the rightmost position, and each successive position to the left has a higher place value Base 2 The value of each position corresponds to powers of 2 d 4 d 3 d 2 d d = + d 4 2 4 + d 3 2 3 + d 2 2 2 + d 2 + d 2 Each digit to the left is 2 times the previous digit. (483) = 2 8 + 2 7 + 2 6 + 2 5 + 2 4 + 2 3 + 2 2 + 2 + 2 To multiply a number by 2 you can simply shift it to the left by one digit, and fill in the rightmost digit with a 2= (5*2 = ) To divide a number by 2, simply shift the number to the right by one digit (moving the decimal place one to the left). 2=. (5 2=2.5) With n digits, 2 n unique numbers can be represented If n=8, 256 (=2 8 ) numbers can be represented -. n n n [, (n-)] [, (n-)] [, (n-)] [, (n-)]

Comparing Binary with Decimal Binary:Decimal : : :2 :3 :4 :5 :6 :7 Binary:Decimal :8 :9 : : :2 :3 :4 :5

Binary Code Language with an alphabet of two symbols and, FALSE or TRUE, etc. Most economical way of encoding information Example from von Baeyer s [24] book Information: The new language of Science Consider a sailor who wants to signal a number between and 27 by means of flags. : : 2: 3: 4: 5: 6: 7: Message from Ship System : one flag per number 24 System 2: decimal system 2 4 28 Flags 2 Flags Required Flags. 27... 9... 9 System 2: binary system 4 Flags

Memory: Punch Card Binary Representation Holes denote s With 8 holes permissible 2 8 = 256 numbers possible per column

Converting Binary to Decimal 2 8 = 256 2 7 = 28 2 6 = 64 2 5 = 32 2 4 = 6 2 3 = 8 2 2 = 4 2 = 2 2 = 2 8 2 7 2 6 2 5 2 4 2 3 2 2 2 28+ 64 + 8 + 2 2 d 4 d 3 d 2 d d = + d 4 2 4 + d 3 2 3 + d 2 2 2 + d 2 + d 2

Base Conversion Decimal to Binary Repeated Division by 2 Divide the decimal number by 2 decimal quotient Remain. binary If the remainder is, on the side write down a If the remainder is, write down a 58 29 Continue until the quotient is 29 4 7 4 7 3 Remainders are written beginning at the least significant digit (right) and each new digit is written to left (the most significant digit ) of the previous digit. 3

Dealing with rational numbers 2 4 = 6 2 3 = 8 2 2 = 4 2 = 2 2 = 2 - =.5 2-2 =.25 2-3 =.25 2 4 6 2 3 2 2 2 2 2-2 -2 2-3 + 8 + + 25.25...25 d 2 d d.d - d -2 = + d 2 2 2 + d 2 + d 2 + d - 2 - + d -2 2-2 +

Binary groupings Bit Size: - (2 Values) Nibble Size: 4-5 (6 Values) Byte Size: 8-255 (256 Values) Word Size: 6-65535 (65536)

Binary Arithmetic Addition Rules + =, with no carry, + =, with no carry, + =, with no carry, + =, and you carry a ------- (+4=24) ------- (+2=22)

Binary Multiplication ------- ----------- (+4=4) ------- ------------ ( 2=2)

Signed Integers b 7 b 6 b 5 b 4 b 3 b 2 b b 2 7 2 6 2 5 2 4 2 3 2 2 2 2 x = (+/-) (b 6 2 6 + b 5 2 5 + + b 2 ) = (-)( 2 6 + 2 5 + + 2 ) = (-)(64 + 6 + 4 ) = -84 From Cathy Wyss (I38)

Fixed Point Reals b 9 b 8 b 7 b 6 b 5 b 4 b 3 b 2 b b 2 5 2 4 2 3 2 2 2 2 2-2 -2 2-3 2-4 x = b 9 2 5 + b 8 2 4 + + b 2-4 = 2 5 + 2 4 + + 2-4 = 32 + 6 + 2 +.25 +.625 = 5.325 From Cathy Wyss (I38)

Floating Point x = (+/-)(+F) 2 E-B 2-4 Sign (+/-) denotes a positive number denotes a negative number Exponent (E-B) The exponent base (2) is implicit and need not be stored. A bias (B) is added to represent both positive and negative exponents. IEEE single-precision floats B=27. If E = 27, exponent is zero If E = 2, exponent is (2-27) 73. IEEE double precision, exponent field is bits, and bias is 23. Mantissa ( + F) Fraction (F) plus an implicit leading digit. sign exponent fraction b 9 b 8 b 7 b 6 b 5 b 4 b 3 b 2 b b 2 5 2 4 2 3 2 2 2 2 2-2 -2 2-3 (+/-) E F

Floating Point Reals sign exponent fraction b 9 b 8 b 7 b 6 b 5 b 4 b 3 b 2 b b 2 5 2 4 2 3 2 2 2 2 2-2 -2 2-3 2-4 = -8.875 length of exponent Given: bias (here: 5) x = (+/-)(+F) 2 E-B = (-)(+(.25 +.625)) 2 (2+6)-5 = (-)(.875) 2 3 From Cathy Wyss (I38)

Hexadecimal Base 6 6 symbols:,,2,3,4,5,6,7,8,9, A, B, C, D, E, F Easy to convert to and from Binary 6 is a power of 2: 6 = 2 4 It takes 4 binary digits for every hexadecimal one Good to represent binary in compressed form! Hex Bin Hex Bin Hex Bin Hex Bin 4 8 C 5 9 D 2 6 A E 3 7 B F

Encoding Text ASCII American Standard Code for Information Interchange between binary numbers and computer and roman symbols Standard to allow computers to communicate textual data Uses 7 bits to encode 28 symbols or characters 2 7 = 28. It fills a byte, but the 8 th bit is used to encode additional symbols for other languages and graphics Usually described in hexadecimal 4 groups of 32 characters to F: control characters Mostly printer/display operations: carriage return (Dh), line feed (Ah), back space (8h), etc. 2 to 3F: punctuation, numeric, and special characters Space (2h), digits -9 (3h-39h) Arranged so that by subtracting 3h from the ASCII code for any digit, we obtain the numeric equivalent of the digit 4 to 5F: uppercase letters, plus some special characters 6 to 7F: lowercase letters, plus some special characters and a control character (DEL)

ASCII Table

Extended ASCII Table

Alternative Extended ASCII

ASCII Art

Unicode Extends ASCII Much greater support for international characters, glyphs, math symbols, etc. Universal Code for Text Each character has a single and unique code in every computer everywhere code point Initially using 6-bits 65536 possible code points Sufficient space to include all the characters for every language on the planet Characters organized into different ranges Greek stored between 88 and 23 (x37 and x3ff) Accepted by the International Standards Organization (ISO) Version 3. in 2 was expanded to 2-bits over million different code points Logical "planes" contain broad classes of characters

Unicode http://www.unicode.org/charts/

Markup Languages In addition to the symbols, specify formatting, hyperlinks, images, media, etc. represents text as well as details about the structure and appearance of the text SGML: Standard Generalized Markup Language Specifies a syntax for including the markup in documents, as well as a description of what the markup meant HTML: HyperText Markup Language Does not require a definition of what the markup means XML: Extensible Markup Language Allows the creation of special-purpose markup languages Simplified subset of SGML, also requiring a definition of what the Markup means Can describing many different kinds of data. LaTeX: best way to typeset complex mathematical formulas

More about data representation I38: Information Representation C.M. Wyss The basic structure of information representation in social and scientific applications. Information access and representation on the World Wide Web; object-oriented design and relational databases; AI knowledge representation and discovery.

Topics Next Class! Encoding Multimedia Readings for Next week Lecture notes Posted online @ http://informatics.indiana.edu/rocha/i Modeling the World @ infoport Read Binary encoding resources at Infoport!! From course package From Irv Englander s book The Architecture of Computer Hardware and Systems Software Chapter 3: Data Formats (pp. 7-86) Lab 6 More Unix and FTP