Number Systems Denary Base 10 Binary Base 2 Hexadecimal Base 16

Slides:



Advertisements
Similar presentations
The Binary Numbering Systems
Advertisements

King Fahd University of Petroleum and Minerals
Digital Fundamentals Floyd Chapter 2 Tenth Edition
Data Representation Computer Organization &
Data Representation COE 205
Connecting with Computer Science, 2e
Assembly Language and Computer Architecture Using C++ and Java
Level ISA3: Information Representation
Assembly Language and Computer Architecture Using C++ and Java
2-1 Computer Organization Part Fixed Point Numbers Using only two digits of precision for signed base 10 numbers, the range (interval between lowest.
Data Representation ICS 233
Data Representation in Computers
Digital Fundamentals Floyd Chapter 2 Tenth Edition
The Binary Number System
Binary Numbers 1.Binary and Denary RecapBinary.
Binary Number Systems.
Connecting with Computer Science 2 Objectives Learn why numbering systems are important to understand Refresh your knowledge of powers of numbers Learn.
The Binary Number System
Data Representation Number Systems.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Simple Data Type Representation and conversion of numbers
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
Numeral Systems Subjects: Numeral System Positional systems Decimal
Data Representation – Binary Numbers
Computers Organization & Assembly Language
1 Digital Technology and Computer Fundamentals Chapter 1 Data Representation and Numbering Systems.
IT253: Computer Organization
Binary Arithmetic & Data representation
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.
Binary, Decimal and Hexadecimal Numbers Svetlin Nakov Telerik Corporation
Lecture 5. Topics Sec 1.4 Representing Information as Bit Patterns Representing Text Representing Text Representing Numeric Values Representing Numeric.
Computer Systems Architecture Copyright © Genetic Computer School 2008 CSA 1- 0 Lesson 1 Number System.
Number systems, Operations, and Codes
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
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 Data Representation Characters, Integers and Real Numbers Binary Number System Octal Number System Hexadecimal Number System Powered by DeSiaMore.
1 Representation of Data within the Computer Oct., 1999(Revised 2001 Oct)
Data Representation Conversion 24/04/2017.
Data Representation, Number Systems and Base Conversions
Computer Math CPS120 Introduction to Computer Science Lecture 4.
AEEE2031 Data Representation and Numbering Systems.
Number Systems & Operations
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
Chapter 1 Representing Data in a Computer. 1.1 Binary and Hexadecimal Numbers.
Data Representation COE 301 Computer Organization Dr. Muhamed Mudawar
Lecture No. 4 Computer Logic Design. Negative Number Representation 3 Options –Sign-magnitude –One’s Complement –Two’s Complement  used in computers.
The Hexadecimal System is base 16. It is a shorthand method for representing the 8-bit bytes that are stored in the computer system. This system was chosen.
 Computers are 2-state devices › Pulse – No pulse › On – Off  Represented by › 1 – 0  BINARY.
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.
Data Representation COE 308 Computer Architecture
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
Chapter 3 Data Representation
CS1010 Programming Methodology
Data Representation COE 301 Computer Organization
Data Representation Data Types Complements Fixed Point Representation
Data Representation Conversion 05/12/2018.
Data Representation ICS 233
23/04/2019 Data Representation Conversion.
Data Representation COE 308 Computer Architecture
Presentation transcript:

Number Systems Denary Base 10 Binary Base 2 Hexadecimal Base 16 Conversion between number systems. Signed numbers, 2’s complements binary and binary fractions. Floating point formats. Simple arithmetic operations using binary number. Bits, bytes and words

Denary Base 10 The base-10 system (decimal) is the most commonly used today ( 0 1 2 3 4 5 6 7 8 9) To represent the number four thousand three hundred and twenty one (4321) Thousand Hundreds Tens Units 103 102 101 100 1000 10 1 4×1000 3×100 2×10 1×1 4000 +300 +20 Total 4321

Binary Base 2 The base-2 system (Binary) the binary system is used internally by virtually all modern computers. ( ‘0’ or ‘1’ ) 1 27 26 25 24 23 22 21 20 127 64 32 16 8 4 2 0×127 1×64 0×32 1×16 1×8 1×4 0×2 1×1 +64 +0 +16 +8 +4 +1 Total 93

Hexadecimal Base 16 The base-16 system (Hexadecimal) uses the numerals “0 1 2 3 4 5 6 7 8 9 B C D E F” Easy to represent binary code (form of shorthand) in which one hexadecimal digit stands in place of four binary bits. F A 161 160 16 1 15×16 10×1 240 +10 Total Hex f a Binary ,1111 1010

Converting from denary to binary 1) Start with the number you want (44) 2) Divide by the base you want to convert to (2) 3) Calculate the remainder from the sum 4) Place result of the sum on the next row Number Base required Remainder 44 ÷ 2 22 11 1 5 44 denary = 101100 binary

Converting from denary to hex 1) Start with the number you want (4321) 2) Divide by the base you want to convert to (16) 3) Calculate the remainder from the sum 4) Place result of the sum on the next row Number Base required Remainder 4321 ÷ 16 1 270 E (14) 4321 Denary = 10E1 Hexadecimal

Denary, Hex & Binary Denary Hex Binary 1 2 3 4 5 6 7 8 9 10 A 11 B 12 1 2 3 4 5 6 7 8 9 10 A 11 B 12 C 13 D 14 E 15 F

Signed numbers In mathematics negative numbers can be prefixed by the '-' symbol. On a computer system several methods cane be used Use of a sign bit Often Most Significant bit is used for the sign Number Binary 7 1 ......1 -0 -1......... -7 4 Bits gives a range -7 to +7 Two representations of '0'

1's complement To obtain the negative number the positive binary value is complemented '0' replaced with '1' and '1' replaced with '0' For example binary 00001010 (decimal 10) complemented becomes 11110101

2's complement To obtain the 2's complement of a number First the 1's complement is obtained Then 1 is added i.e. decimal 10 = 00001010, complemented = 11110101 add 1 = 11110110. Advantage of 2's complement is that no separate addition and subtraction circuits are required

Binary fractions So far only integer numbers have been considered Whole Number Fraction 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 sign 26 25 24 23 22 21 20 2-1 2-2 2-3 2-4 2-5 2-6 2-7 2-8 Decimal 10.75 would be 1010.11 Limited by the number of bits assigned to whole number Accuracy is lost smallest value is 0.00390625

Floating point numbers In scientific applications we often need very small or large numbers In the floating point system number is represented by a signed fractional component called the mantissa and a signed exponent. mantissa × 10exponent The value is normalised i.e. 1230000.0 would be become 0.123×107 In a typical system where a float is 32 bits 24 bits hold the signed mantissa and 8bits for the exponent Floating point calculations often carried out in a separate co processor

Binary arithmetic Binary addition Dec Binary 10 1 +9 19 A op B Sum Carry + 1 Dec Binary 10 1 +9 19

Binary arithmetic Binary subtraction A op B Sum borrow - 1 - 1 * * * * (starred columns are borrowed from) 1 1 0 1 1 1 0 − 1 0 1 1 1 ---------------- = 1 0 1 0 1 1 1

Binary arithmetic Multiplication - Two numbers A and B can be multiplied by partial products: for each digit in B, the product of that digit in A is calculated and written on a new line, shifted leftward so that its rightmost digit lines up with the digit in B that was used. The sum of all these partial products gives the final result. 1 0 1 1 (A) (decimal 11) × 1 0 1 0 (B) (decimal 10) --------- 0 0 0 0 ← Corresponds to a zero in B + 1 0 1 1 ← Corresponds to a one in B + 0 0 0 0 + 1 0 1 1 --------------- = 1 1 0 1 1 1 0 (decimal 110)

Binary arithmetic Division i.e. divide 0110101 (53) by 0101 (5). ___ 1010 (10 answer) 0101| 0110101 0101 110 11 (3 remainder)

Bits Bytes & Words Bit either a '1' or a '0' Byte comprises 8 bits ' 10110011' Nibble - Half a byte (4 bits) '1011' Word Normally the bus width of the microprocessor – in this case 32 bits Hex numbers in the keil compiler are prefixed by '0x' (0xa7) Floating point numbers – exponent is represented by the letter 'e' (1.25e-3)

ASCII character codes Integer numbers are easily represented in binary. This is not the case for characters and other punctuation marks. The standard ASCII code defines 128 character codes (from 0 to 127), of which, the first 32 are control codes (non-printable), and the other 96 are represent printable characters. The ASCII code requires a 7 bit binary code. Memory is usually a 8-bit wide which leaves 1 unused bit – use to provide additional characters called Extended ASCII. Not standardised!

The Standard ASCII Table * 1 2 3 4 5 6 7 8 9 A B C D E F NUL SOH STX ETX EOT ENQ ACK BEL BS TAB LF VT FF CR SO SI DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US   ! " # $ % & ' ( ) + , - . / : ; < = > ? @ G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~   * This table is organized to be easily read in hexadecimal: row numbers represent the first digit and the column numbers represent the second one. For example, the A character is located at the 4throw and the 1st column, for that it would be represented in hexadecimal as 0x41 (6510).

Unicode ASCII only supports 128 characters ASCII was extended to 255 characters using the iso 8859 method, where 15  regions/language groups were defined. Unicode method contains all the worlds characters (well almost) in one coding list. Uses multibyte encoding of 1,2 or 4 bytes Common coding is UTF-8 first 128 codes same as ASCII so provides backwards compatibility See http://www.unicode.org