# Number Representation

Size: px
Start display at page:

Transcription

1 Number Representation CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur

2 Topics to be Discussed How are numeric data items actually stored in computer memory? How much space (memory locations) is allocated for each type of data? int, float, char, etc. How are characters and strings stored in memory?

3 Number System :: The Basics We are accustomed to using the so-called decimal number system. Ten digits :: 0,1,2,3,4,5,6,7,8,9 Every digit position has a weight which is a power of 10. Base or radix is 10. Example: 234 = 2 x x x = 2 x x x x x 10-2

4 Binary Number System Two digits: 0 and 1. Every digit position has a weight which is a power of 2. Base or radix is 2. Example: 110 = 1 x x x = 1 x x x x x 2-2

5 Binary-to-Decimal Conversion Each digit position of a binary number has a weight. Some power of 2. A binary number: B = b n-1 b n-2..b 1 b 0. b -1-1 b b -m Corresponding value in decimal: n-1 D = Σ i = -m b i 2 i

6 Examples x x x x x x2 0 = 43 (101011) 2 = (43) x2 + 1x2 + 0x2 + 1x2 =.3125 (.0101) 2 = (.3125) x x x x2 + 1x (101.11) 2 = (5.75) 10

7 Decimal-to-Binary Conversion Consider the integer and fractional parts separately. For the integer part, Repeatedly divide the given number by 2, and go on accumulating the remainders, until the number becomes zero. Arrange the remainders in reverse order. For the fractional part, Repeatedly multiply the given fraction by 2. Accumulate the integer part (0 or 1). If the integer part is 1, chop it off. Arrange the integer parts in the order they are obtained.

8 Example 1 :: (239) 10 = ( ) 2

9 Example 2 :: (64) 10 = ( ) 2

10 Example 3 :: x 2 = x 2 = x 2 = x 2 = x 2 = : : (.634) 10 = ( ) 2

11 Example 4 :: (37) 10 = (100101) 2 (.0625) 10 = (.0001) 2 ( ) 10 = ( ) 2

12 Hexadecimal Number System A compact way of representing binary numbers. 16 different symbols (radix = 16) A B C D E F 1111

13 Binary-to-Hexadecimal Conversion For the integer part, Scan the binary number from Scan the binary number from right to left. Translate each group of four bits into the corresponding hexadecimal digit. Add leading zeros if necessary. For the fractional part, Scan the binary number from Scan the binary number from left to right. Translate each group of four bits into the corresponding hexadecimal digit. Add trailing zeros if necessary.

14 Example 1. ( ) 2 = (B43) ( ) 2 = (2A1) ( ) 2 = (.84) ( ) 2 = (5.5E) 16

15 Hexadecimal-to-Binary Conversion Translate every hexadecimal digit into its 4-bit binary equivalent. Examples: (3A5) 16 = ( ) 2 (12.3D) 16 = ( ) 2 (1.8) 16 = ( ) 2

16 Unsigned Binary Numbers An n-bit binary number B = b n-1 b n-2. b 2 b 1 b 0 2 n distinct combinations are possible, 0 to 2 n -1. For example, for n = 3, there are 8 distinct combinations. 000, 001, 010, 011, 100, 101, 110, 111 Range of numbers that can be represented n=8 0 to (255) n=16 0 to 2-1 (65535) n=32 0 to 2-1 ( )

17 Signed Integer Representation Many of the numerical data items that are used in a program are signed (positive or negative). Question:: How to represent sign? Three possible approaches: Sign-magnitude representation One s complement representation Two s complement representation

18 Sign-magnitude Representation For an n-bit number representation The most significant bit (MSB) indicates sign 0 positive 1 negative The remaining n-1 bits represent magnitude. b n-1 b n-2 b 1 b 0 Sign Magnitude

19 Contd. Range of numbers that can be represented: Maximum :: + (2 n-1 1) Minimum :: (2 n-1 1) A problem: Two different representations of zero

20 One s Complement Representation Basic idea: Positive numbers are represented exactly as in sign- magnitude form. Negative numbers are represented in 1 s complement form. How to compute the 1 s complement of a number? Complement every bit of the number (1 0 and 0 0 1). MSB will indicate the sign of the number. 0 positive 1 negative

21 Example :: n= To find the representation of, say, -4, first note that +4 = = 1 s complement of 0100 = 1011

22 Contd. Range of numbers that can be represented: Maximum :: + (2 n-1 1) Minimum :: (2 n-1 1) A problem: Two different representations of zero Advantage of 1 s complement representation Subtraction can be done using addition. Leads to substantial saving in circuitry.

23 Two s Complement Representation Basic idea: Positive numbers are represented exactly as in sign- magnitude form. Negative numbers are represented in 2 s complement form. How to compute the 2 s complement of a number? Complement every bit of the number (1 0 and 0 0 1), and then add one to the resulting number. MSB will indicate the sign of the number. 0 positive 1 negative

24 Example :: n= To find the representation of, say, -4, first note that +4 = = 2 s complement of 0100 = = 1100

25 Contd. Range of numbers that can be represented: Maximum :: + (2 n-1 1) Minimum :: 2 n-1 Advantage: Unique representation of zero. Subtraction can be done using addition. Leads to substantial saving in circuitry. Almost all computers today use the 2 s complement representation for storing negative numbers.

26 Contd. In C short int 16 bits + (2 15-1) to int 32 bits + (2 31-1) to long int 64 bits + (2 63-1) to -2 63

27 Subtraction Using Addition :: 1 s Complement How to compute A B? Compute the 1 s complement of B (say, B 1 ). Compute R = A + B 1 If the carry obtained after addition is 1 Add the carry back to R (called end-around carry). That is, R = R + 1. The result is a positive number. Else The result is negative, and is in 1 s complement form.

28 Example 1 :: s complement of 2 = :: :: A B 1 R Assume 4-bit representations. Since there is a carry, it is added back to the result. End-around carry The result is positive.

29 Example 2 :: s complement of 5 = :: :: A B 1 R Assume 4-bit representations. -2 Since there is no carry, the result is negative is the 1 s complement of 0010, that is, it represents 2.

30 Subtraction Using Addition :: 2 s Complement How to compute A B? Compute the 2 s complement of B (say, B 2 ). Compute R = A + B 2 If the carry obtained after addition is 1 Ignore the carry. The result is a positive number. Else The result is negative, and is in 2 s complement form.

31 Example 1 :: s complement of 2 = = :: 0110 A -2 :: B 2 Assume 4-bit representations. Ignore carry +4 R Presence of carry indicates that the result is positive. No need to add the endaround carry like in 1 s complement.

32 Example 2 :: s complement of 5 = = :: :: A B 2 R Assume 4-bit representations. -2 Since there is no carry, the result is negative is the 2 s complement of 0010, that is, it represents 2.

33 Floating-point Numbers The representations discussed so far applies only to integers. Cannot represent numbers with fractional parts. We can assume a decimal point before a 2 s complement number. In that case, pure fractions (without integer parts) can be represented. We can also assume the decimal point somewhere in between. This lacks flexibility. Very large and very small numbers cannot be represented.

34 Representation of Floating-Point Numbers A floating-point number F is represented by a doublet <M,E> : F = M x B E B exponent base (usually 2) M mantissa E exponent M is usually represented in 2 s complement form, with an implied decimal point before it. For example, In decimal, x 10 6 In binary, x

35 Example :: 32-bit representation M E M represents a 2 s complement fraction 1 > M > -1 E represents the exponent (in 2 s complement form) 127 > E > -128 Points to note: 24 8 The number of significant digits depends on the number of bits in M. 6 significant digits for 24-bit mantissa. The range of the number depends on the number of bits in E to for 8-bit exponent.

36 A Warning The representation for floating-point numbers as shown is just for illustration. The actual representation is a little more complex. In C: float :: 32-bit representation double :: 64-bit representation

37 Representation of Characters Many applications have to deal with non-numerical data. Characters and strings. There must be a standard mechanism to represent alphanumeric and other characters in memory. Three standards in use: Extended Binary Coded Decimal Interchange Code (EBCDIC) Used in older IBM machines. American Standard Code for Information Interchange (ASCII) Most widely used today. UNICODE Used to represent all international characters. Used by Java.

38 ASCII Code Each individual character is numerically encoded into a unique 7- bit binary code. A total of 2 7 or 128 different characters. A character is normally encoded in a byte (8 bits), with the MSB not been used. The binary encoding of the characters follow a regular ordering. Digits are ordered consecutively in their proper numerical sequence (0 to 9). Letters (uppercase and lowercase) are arranged consecutively in their proper alphabetic order.

39 Some Common ASCII Codes A :: 41 (H) 65 (D) B :: 42 (H) 66 (D).. Z :: 5A (H) 90 (D) 0 :: 30 (H) 48 (D) 1 :: 31 (H) 49 (D).. 9 :: 39 (H) 57 (D) a :: 61 (H) 97 (D) b :: 62 (H) 98 (D).. z :: 7A (H) 122 (D) ( :: 28 (H) 40 (D) + :: 2B (H) 43 (D)? :: 3F (H) 63 (D) \n :: 0A (H) 10 (D) \0 :: 00 (H) 00 (D)

40 Character Strings Two ways of representing a sequence of characters in memory. The first location contains the number of characters in the string, followed by the actual characters. 5 H e l l o The characters follow one another, and is terminated by a special delimiter. H e l l o

41 String Representation in C In C, the second approach is used. The \0 character is used as the string delimiter. Example: Hello H e l l o \0 A null string occupies one byte in memory. Only the \0 character.

### The string of digits 101101 in the binary number system represents the quantity

Data Representation Section 3.1 Data Types Registers contain either data or control information Control information is a bit or group of bits used to specify the sequence of command signals needed for

### Oct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8

ECE Department Summer LECTURE #5: Number Systems EEL : Digital Logic and Computer Systems Based on lecture notes by Dr. Eric M. Schwartz Decimal Number System: -Our standard number system is base, also

### LSN 2 Number Systems. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology

LSN 2 Number Systems Department of Engineering Technology LSN 2 Decimal Number System Decimal number system has 10 digits (0-9) Base 10 weighting system... 10 5 10 4 10 3 10 2 10 1 10 0. 10-1 10-2 10-3

### Chapter 4: Computer Codes

Slide 1/30 Learning Objectives In this chapter you will learn about: Computer data Computer codes: representation of data in binary Most commonly used computer codes Collating sequence 36 Slide 2/30 Data

### Systems I: Computer Organization and Architecture

Systems I: Computer Organization and Architecture Lecture 2: Number Systems and Arithmetic Number Systems - Base The number system that we use is base : 734 = + 7 + 3 + 4 = x + 7x + 3x + 4x = x 3 + 7x

### Solution for Homework 2

Solution for Homework 2 Problem 1 a. What is the minimum number of bits that are required to uniquely represent the characters of English alphabet? (Consider upper case characters alone) The number of

### Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 04 Digital Logic II May, I before starting the today s lecture

### CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

CDA 3200 Digital Systems Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012 Outline Data Representation Binary Codes Why 6-3-1-1 and Excess-3? Data Representation (1/2) Each numbering

### CSI 333 Lecture 1 Number Systems

CSI 333 Lecture 1 Number Systems 1 1 / 23 Basics of Number Systems Ref: Appendix C of Deitel & Deitel. Weighted Positional Notation: 192 = 2 10 0 + 9 10 1 + 1 10 2 General: Digit sequence : d n 1 d n 2...

### 2010/9/19. Binary number system. Binary numbers. Outline. Binary to decimal

2/9/9 Binary number system Computer (electronic) systems prefer binary numbers Binary number: represent a number in base-2 Binary numbers 2 3 + 7 + 5 Some terminology Bit: a binary digit ( or ) Hexadecimal

### Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)

Unit- I Introduction to c Language: C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating

### Numbering Systems. InThisAppendix...

G InThisAppendix... Introduction Binary Numbering System Hexadecimal Numbering System Octal Numbering System Binary Coded Decimal (BCD) Numbering System Real (Floating Point) Numbering System BCD/Binary/Decimal/Hex/Octal

### Levent EREN levent.eren@ieu.edu.tr A-306 Office Phone:488-9882 INTRODUCTION TO DIGITAL LOGIC

Levent EREN levent.eren@ieu.edu.tr A-306 Office Phone:488-9882 1 Number Systems Representation Positive radix, positional number systems A number with radix r is represented by a string of digits: A n

### Computer Science 281 Binary and Hexadecimal Review

Computer Science 281 Binary and Hexadecimal Review 1 The Binary Number System Computers store everything, both instructions and data, by using many, many transistors, each of which can be in one of two

### NUMBER SYSTEMS. 1.1 Introduction

NUMBER SYSTEMS 1.1 Introduction There are several number systems which we normally use, such as decimal, binary, octal, hexadecimal, etc. Amongst them we are most familiar with the decimal number system.

### Binary Representation. Number Systems. Base 10, Base 2, Base 16. Positional Notation. Conversion of Any Base to Decimal.

Binary Representation The basis of all digital data is binary representation. Binary - means two 1, 0 True, False Hot, Cold On, Off We must be able to handle more than just values for real world problems

### Binary Number System. 16. Binary Numbers. Base 10 digits: 0 1 2 3 4 5 6 7 8 9. Base 2 digits: 0 1

Binary Number System 1 Base 10 digits: 0 1 2 3 4 5 6 7 8 9 Base 2 digits: 0 1 Recall that in base 10, the digits of a number are just coefficients of powers of the base (10): 417 = 4 * 10 2 + 1 * 10 1

### EE 261 Introduction to Logic Circuits. Module #2 Number Systems

EE 261 Introduction to Logic Circuits Module #2 Number Systems Topics A. Number System Formation B. Base Conversions C. Binary Arithmetic D. Signed Numbers E. Signed Arithmetic F. Binary Codes Textbook

### 2011, The McGraw-Hill Companies, Inc. Chapter 3

Chapter 3 3.1 Decimal System The radix or base of a number system determines the total number of different symbols or digits used by that system. The decimal system has a base of 10 with the digits 0 through

### To convert an arbitrary power of 2 into its English equivalent, remember the rules of exponential arithmetic:

Binary Numbers In computer science we deal almost exclusively with binary numbers. it will be very helpful to memorize some binary constants and their decimal and English equivalents. By English equivalents

### Lecture 2. Binary and Hexadecimal Numbers

Lecture 2 Binary and Hexadecimal Numbers Purpose: Review binary and hexadecimal number representations Convert directly from one base to another base Review addition and subtraction in binary representations

### Data Storage. Chapter 3. Objectives. 3-1 Data Types. Data Inside the Computer. After studying this chapter, students should be able to:

Chapter 3 Data Storage Objectives After studying this chapter, students should be able to: List five different data types used in a computer. Describe how integers are stored in a computer. Describe how

### Today. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real- Time Systems: Binary Arithmetic

Today Binary addition Representing negative numbers 2 Binary Addition Consider the following binary numbers: 0 0 1 0 0 1 1 0 0 0 1 0 1 0 1 1 How do we add these numbers? 3 Binary Addition 0 0 1 0 0 1 1

### Lecture 11: Number Systems

Lecture 11: Number Systems Numeric Data Fixed point Integers (12, 345, 20567 etc) Real fractions (23.45, 23., 0.145 etc.) Floating point such as 23. 45 e 12 Basically an exponent representation Any number

### Computers. Hardware. The Central Processing Unit (CPU) CMPT 125: Lecture 1: Understanding the Computer

Computers CMPT 125: Lecture 1: Understanding the Computer Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University January 3, 2009 A computer performs 2 basic functions: 1.

### plc numbers - 13.1 Encoded values; BCD and ASCII Error detection; parity, gray code and checksums

plc numbers - 3. Topics: Number bases; binary, octal, decimal, hexadecimal Binary calculations; s compliments, addition, subtraction and Boolean operations Encoded values; BCD and ASCII Error detection;

### NUMBER SYSTEMS. William Stallings

NUMBER SYSTEMS William Stallings The Decimal System... The Binary System...3 Converting between Binary and Decimal...3 Integers...4 Fractions...5 Hexadecimal Notation...6 This document available at WilliamStallings.com/StudentSupport.html

### 1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal:

Exercises 1 - number representations Questions 1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal: (a) 3012 (b) - 435 2. For each of

### CPEN 214 - Digital Logic Design Binary Systems

CPEN 4 - Digital Logic Design Binary Systems C. Gerousis Digital Design 3 rd Ed., Mano Prentice Hall Digital vs. Analog An analog system has continuous range of values A mercury thermometer Vinyl records

### Numeral Systems. The number twenty-five can be represented in many ways: Decimal system (base 10): 25 Roman numerals:

Numeral Systems Which number is larger? 25 8 We need to distinguish between numbers and the symbols that represent them, called numerals. The number 25 is larger than 8, but the numeral 8 above is larger

### Base Conversion written by Cathy Saxton

Base Conversion written by Cathy Saxton 1. Base 10 In base 10, the digits, from right to left, specify the 1 s, 10 s, 100 s, 1000 s, etc. These are powers of 10 (10 x ): 10 0 = 1, 10 1 = 10, 10 2 = 100,

### Number Conversions Dr. Sarita Agarwal (Acharya Narendra Dev College,University of Delhi)

Conversions Dr. Sarita Agarwal (Acharya Narendra Dev College,University of Delhi) INTRODUCTION System- A number system defines a set of values to represent quantity. We talk about the number of people

### Data Storage 3.1. Foundations of Computer Science Cengage Learning

3 Data Storage 3.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List five different data types used in a computer. Describe how

### HOMEWORK # 2 SOLUTIO

HOMEWORK # 2 SOLUTIO Problem 1 (2 points) a. There are 313 characters in the Tamil language. If every character is to be encoded into a unique bit pattern, what is the minimum number of bits required to

### Goals. Unary Numbers. Decimal Numbers. 3,148 is. 1000 s 100 s 10 s 1 s. Number Bases 1/12/2009. COMP370 Intro to Computer Architecture 1

Number Bases //9 Goals Numbers Understand binary and hexadecimal numbers Be able to convert between number bases Understand binary fractions COMP37 Introduction to Computer Architecture Unary Numbers Decimal

### CS101 Lecture 11: Number Systems and Binary Numbers. Aaron Stevens 14 February 2011

CS101 Lecture 11: Number Systems and Binary Numbers Aaron Stevens 14 February 2011 1 2 1 3!!! MATH WARNING!!! TODAY S LECTURE CONTAINS TRACE AMOUNTS OF ARITHMETIC AND ALGEBRA PLEASE BE ADVISED THAT CALCULTORS

### Number and codes in digital systems

Number and codes in digital systems Decimal Numbers You are familiar with the decimal number system because you use them everyday. But their weighted structure is not understood. In the decimal number

### Binary Representation

Binary Representation The basis of all digital data is binary representation. Binary - means two 1, 0 True, False Hot, Cold On, Off We must tbe able to handle more than just values for real world problems

### Divide: Paper & Pencil. Computer Architecture ALU Design : Division and Floating Point. Divide algorithm. DIVIDE HARDWARE Version 1

Divide: Paper & Pencil Computer Architecture ALU Design : Division and Floating Point 1001 Quotient Divisor 1000 1001010 Dividend 1000 10 101 1010 1000 10 (or Modulo result) See how big a number can be

### Binary, Hexadecimal, Octal, and BCD Numbers

23CH_PHCalter_TMSETE_949118 23/2/2007 1:37 PM Page 1 Binary, Hexadecimal, Octal, and BCD Numbers OBJECTIVES When you have completed this chapter, you should be able to: Convert between binary and decimal

### COMPSCI 210. Binary Fractions. Agenda & Reading

COMPSCI 21 Binary Fractions Agenda & Reading Topics: Fractions Binary Octal Hexadecimal Binary -> Octal, Hex Octal -> Binary, Hex Decimal -> Octal, Hex Hex -> Binary, Octal Animation: BinFrac.htm Example

### Useful Number Systems

Useful Number Systems Decimal Base = 10 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} Binary Base = 2 Digit Set = {0, 1} Octal Base = 8 = 2 3 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7} Hexadecimal Base = 16 = 2

### The programming language C. sws1 1

The programming language C sws1 1 The programming language C invented by Dennis Ritchie in early 1970s who used it to write the first Hello World program C was used to write UNIX Standardised as K&C (Kernighan

### Pemrograman Dasar. Basic Elements Of Java

Pemrograman Dasar Basic Elements Of Java Compiling and Running a Java Application 2 Portable Java Application 3 Java Platform Platform: hardware or software environment in which a program runs. Oracle

### The New IoT Standard: Any App for Any Device Using Any Data Format. Mike Weiner Product Manager, Omega DevCloud KORE Telematics

The New IoT Standard: Any App for Any Device Using Any Data Format Mike Weiner Product Manager, Omega DevCloud KORE Telematics About KORE The world s largest M2M/IoT services provider 12 Carriers Enterprise

### Encoding Text with a Small Alphabet

Chapter 2 Encoding Text with a Small Alphabet Given the nature of the Internet, we can break the process of understanding how information is transmitted into two components. First, we have to figure out

### COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

Binary numbers The reason humans represent numbers using decimal (the ten digits from 0,1,... 9) is that we have ten fingers. There is no other reason than that. There is nothing special otherwise about

### Binary Numbering Systems

Binary Numbering Systems April 1997, ver. 1 Application Note 83 Introduction Binary numbering systems are used in virtually all digital systems, including digital signal processing (DSP), networking, and

### This 3-digit ASCII string could also be calculated as n = (Data[2]-0x30) +10*((Data[1]-0x30)+10*(Data[0]-0x30));

Introduction to Embedded Microcomputer Systems Lecture 5.1 2.9. Conversions ASCII to binary n = 100*(Data[0]-0x30) + 10*(Data[1]-0x30) + (Data[2]-0x30); This 3-digit ASCII string could also be calculated

### Digital Design. Assoc. Prof. Dr. Berna Örs Yalçın

Digital Design Assoc. Prof. Dr. Berna Örs Yalçın Istanbul Technical University Faculty of Electrical and Electronics Engineering Office Number: 2318 E-mail: siddika.ors@itu.edu.tr Grading 1st Midterm -

### ECE 0142 Computer Organization. Lecture 3 Floating Point Representations

ECE 0142 Computer Organization Lecture 3 Floating Point Representations 1 Floating-point arithmetic We often incur floating-point programming. Floating point greatly simplifies working with large (e.g.,

### 6 3 4 9 = 6 10 + 3 10 + 4 10 + 9 10

Lesson The Binary Number System. Why Binary? The number system that you are familiar with, that you use every day, is the decimal number system, also commonly referred to as the base- system. When you

### ASCII Code. Numerous codes were invented, including Émile Baudot's code (known as Baudot

ASCII Code Data coding Morse code was the first code used for long-distance communication. Samuel F.B. Morse invented it in 1844. This code is made up of dots and dashes (a sort of binary code). It was

### 3. Convert a number from one number system to another

3. Convert a number from one number system to another Conversion between number bases: Hexa (16) Decimal (10) Binary (2) Octal (8) More Interest Way we need conversion? We need decimal system for real

### Cyber Security Workshop Encryption Reference Manual

Cyber Security Workshop Encryption Reference Manual May 2015 Basic Concepts in Encoding and Encryption Binary Encoding Examples Encryption Cipher Examples 1 P a g e Encoding Concepts Binary Encoding Basics

### Chapter 7D The Java Virtual Machine

This sub chapter discusses another architecture, that of the JVM (Java Virtual Machine). In general, a VM (Virtual Machine) is a hypothetical machine (implemented in either hardware or software) that directly

### Programming languages C

INTERNATIONAL STANDARD ISO/IEC 9899:1999 TECHNICAL CORRIGENDUM 2 Published 2004-11-15 INTERNATIONAL ORGANIZATION FOR STANDARDIZATION МЕЖДУНАРОДНАЯ ОРГАНИЗАЦИЯ ПО СТАНДАРТИЗАЦИИ ORGANISATION INTERNATIONALE

### Section 1.4 Place Value Systems of Numeration in Other Bases

Section.4 Place Value Systems of Numeration in Other Bases Other Bases The Hindu-Arabic system that is used in most of the world today is a positional value system with a base of ten. The simplest reason

### Digital Logic Design. Introduction

Digital Logic Design Introduction A digital computer stores data in terms of digits (numbers) and proceeds in discrete steps from one state to the next. The states of a digital computer typically involve

### Chapter 1. Binary, octal and hexadecimal numbers

Chapter 1. Binary, octal and hexadecimal numbers This material is covered in the books: Nelson Magor Cooke et al, Basic mathematics for electronics (7th edition), Glencoe, Lake Forest, Ill., 1992. [Hamilton

### DNA Data and Program Representation. Alexandre David 1.2.05 adavid@cs.aau.dk

DNA Data and Program Representation Alexandre David 1.2.05 adavid@cs.aau.dk Introduction Very important to understand how data is represented. operations limits precision Digital logic built on 2-valued

### Binary Numbers. Binary Octal Hexadecimal

Binary Numbers Binary Octal Hexadecimal Binary Numbers COUNTING SYSTEMS UNLIMITED... Since you have been using the 10 different digits 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 all your life, you may wonder how

### A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc

Other architectures Example. Accumulator-based machines A single register, called the accumulator, stores the operand before the operation, and stores the result after the operation. Load x # into acc

### Variables, Constants, and Data Types

Variables, Constants, and Data Types Primitive Data Types Variables, Initialization, and Assignment Constants Characters Strings Reading for this class: L&L, 2.1-2.3, App C 1 Primitive Data There are eight

### CS321. Introduction to Numerical Methods

CS3 Introduction to Numerical Methods Lecture Number Representations and Errors Professor Jun Zhang Department of Computer Science University of Kentucky Lexington, KY 40506-0633 August 7, 05 Number in

### DATA_TYPE Values and Data File Storage Formats

Chapter 3. DATA_TYPE Values and Data File Storage Formats 3-1 Chapter 3. DATA_TYPE Values and Data File Storage Formats Each PDS archived product is described using label objects that provide information

### Informatica e Sistemi in Tempo Reale

Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)

Modbus Frequently Asked Questions WP-34-REV0-0609-1/7 The Answer to the 14 Most Frequently Asked Modbus Questions Exactly what is Modbus? Modbus is an open serial communications protocol widely used in

### Chapter 2: Basics on computers and digital information coding. A.A. 2012-2013 Information Technology and Arts Organizations

Chapter 2: Basics on computers and digital information coding Information Technology and Arts Organizations 1 Syllabus (1/3) 1. Introduction on Information Technologies (IT) and Cultural Heritage (CH)

### Unsigned Conversions from Decimal or to Decimal and other Number Systems

Page 1 of 5 Unsigned Conversions from Decimal or to Decimal and other Number Systems In all digital design, analysis, troubleshooting, and repair you will be working with binary numbers (or base 2). It

### Positional Numbering System

APPENDIX B Positional Numbering System A positional numbering system uses a set of symbols. The value that each symbol represents, however, depends on its face value and its place value, the value associated

### Today s topics. Digital Computers. More on binary. Binary Digits (Bits)

Today s topics! Binary Numbers! Brookshear.-.! Slides from Prof. Marti Hearst of UC Berkeley SIMS! Upcoming! Networks Interactive Introduction to Graph Theory http://www.utm.edu/cgi-bin/caldwell/tutor/departments/math/graph/intro

### Number Systems and Radix Conversion

Number Systems and Radix Conversion Sanjay Rajopadhye, Colorado State University 1 Introduction These notes for CS 270 describe polynomial number systems. The material is not in the textbook, but will

### Measures of Error: for exact x and approximation x Absolute error e = x x. Relative error r = (x x )/x.

ERRORS and COMPUTER ARITHMETIC Types of Error in Numerical Calculations Initial Data Errors: from experiment, modeling, computer representation; problem dependent but need to know at beginning of calculation.

### Chapter 2. Binary Values and Number Systems

Chapter 2 Binary Values and Number Systems Numbers Natural numbers, a.k.a. positive integers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645, 32 Negative numbers A

### ASCII Characters. 146 CHAPTER 3 Information Representation. The sign bit is 1, so the number is negative. Converting to decimal gives

146 CHAPTER 3 Information Representation The sign bit is 1, so the number is negative. Converting to decimal gives 37A (hex) = 134 (dec) Notice that the hexadecimal number is not written with a negative

### CSC4510 AUTOMATA 2.1 Finite Automata: Examples and D efinitions Definitions

CSC45 AUTOMATA 2. Finite Automata: Examples and Definitions Finite Automata: Examples and Definitions A finite automaton is a simple type of computer. Itsoutputislimitedto yes to or no. It has very primitive

### Binary Division. Decimal Division. Hardware for Binary Division. Simple 16-bit Divider Circuit

Decimal Division Remember 4th grade long division? 43 // quotient 12 521 // divisor dividend -480 41-36 5 // remainder Shift divisor left (multiply by 10) until MSB lines up with dividend s Repeat until

### THE BINARY NUMBER SYSTEM

THE BINARY NUMBER SYSTEM Dr. Robert P. Webber, Longwood University Our civilization uses the base 10 or decimal place value system. Each digit in a number represents a power of 10. For example, 365.42

### Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to

### This section describes how LabVIEW stores data in memory for controls, indicators, wires, and other objects.

Application Note 154 LabVIEW Data Storage Introduction This Application Note describes the formats in which you can save data. This information is most useful to advanced users, such as those using shared

### Number Systems. Introduction / Number Systems

Number Systems Introduction / Number Systems Data Representation Data representation can be Digital or Analog In Analog representation values are represented over a continuous range In Digital representation

### NUMBER SYSTEMS TUTORIAL

NUMBER SYSTEMS TUTORIAL Courtesy of: thevbprogrammer.com Number Systems Concepts The study of number systems is useful to the student of computing due to the fact that number systems other than the familiar

### Chapter 1: Digital Systems and Binary Numbers

Chapter 1: Digital Systems and Binary Numbers Digital age and information age Digital computers general purposes many scientific, industrial and commercial applications Digital systems telephone switching

### 1. Convert the following base 10 numbers into 8-bit 2 s complement notation 0, -1, -12

C5 Solutions 1. Convert the following base 10 numbers into 8-bit 2 s complement notation 0, -1, -12 To Compute 0 0 = 00000000 To Compute 1 Step 1. Convert 1 to binary 00000001 Step 2. Flip the bits 11111110

### MACHINE INSTRUCTIONS AND PROGRAMS

CHAPTER 2 MACHINE INSTRUCTIONS AND PROGRAMS CHAPTER OBJECTIVES In this chapter you will learn about: Machine instructions and program execution, including branching and subroutine call and return operations

### 1. Introductory Overview

Chapter 1 1. Introductory Overview The main goal of this chapter is to review fundamental aspects of analogue and digital signals and systems, digital codes, the binary, decimal and hexadecimal numbering

### Stacks. Linear data structures

Stacks Linear data structures Collection of components that can be arranged as a straight line Data structure grows or shrinks as we add or remove objects ADTs provide an abstract layer for various operations

### The use of binary codes to represent characters

The use of binary codes to represent characters Teacher s Notes Lesson Plan x Length 60 mins Specification Link 2.1.4/hi Character Learning objective (a) Explain the use of binary codes to represent characters

### CPU Organization and Assembly Language

COS 140 Foundations of Computer Science School of Computing and Information Science University of Maine October 2, 2015 Outline 1 2 3 4 5 6 7 8 Homework and announcements Reading: Chapter 12 Homework:

### Counting in base 10, 2 and 16

Counting in base 10, 2 and 16 1. Binary Numbers A super-important fact: (Nearly all) Computers store all information in the form of binary numbers. Numbers, characters, images, music files --- all of these

### This Unit: Floating Point Arithmetic. CIS 371 Computer Organization and Design. Readings. Floating Point (FP) Numbers

This Unit: Floating Point Arithmetic CIS 371 Computer Organization and Design Unit 7: Floating Point App App App System software Mem CPU I/O Formats Precision and range IEEE 754 standard Operations Addition

### Correctly Rounded Floating-point Binary-to-Decimal and Decimal-to-Binary Conversion Routines in Standard ML. By Prashanth Tilleti

Correctly Rounded Floating-point Binary-to-Decimal and Decimal-to-Binary Conversion Routines in Standard ML By Prashanth Tilleti Advisor Dr. Matthew Fluet Department of Computer Science B. Thomas Golisano

APPENDIX C The Hexadecimal Number System and Memory Addressing U nderstanding the number system and the coding system that computers use to store data and communicate with each other is fundamental to

### Data Storage: Each time you create a variable in memory, a certain amount of memory is allocated for that variable based on its data type (or class).

Data Storage: Computers are made of many small parts, including transistors, capacitors, resistors, magnetic materials, etc. Somehow they have to store information in these materials both temporarily (RAM,

### Intel Hexadecimal Object File Format Specification Revision A, 1/6/88

Intel Hexadecimal Object File Format Specification Revision A, 1/6/88 DISCLAIMER Intel makes no representation or warranties with respect to the contents hereof and specifically disclaims any implied warranties

### Chapter 5. Binary, octal and hexadecimal numbers

Chapter 5. Binary, octal and hexadecimal numbers A place to look for some of this material is the Wikipedia page http://en.wikipedia.org/wiki/binary_numeral_system#counting_in_binary Another place that