Representation of data types. Introduction We are going to look at representing cardinal numbers, integers and real numbers in decimal, binary, octal.

Slides:



Advertisements
Similar presentations
Appendix 1 Number Systems Objectives: Review of number systems and radix conversion methods Review of binary, octal, hexadecimal and BCD unsigned codes.
Advertisements

CS 151 Digital Systems Design Lecture 3 More Number Systems.
Level ISA3: Information Representation
2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.
ECE 331 – Digital System Design
ECE 301 – Digital Electronics Number Systems and Conversion, Binary Arithmetic, and Representation of Negative Numbers (Lecture #10) The slides included.
Data Representation in Computers
ENGIN112 L3: More Number Systems September 8, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems.
1 Number Systems. 2 Numbers Each number system is associated with a base or radix – The decimal number system is said to be of base or radix 10 A number.
Teaching Computing at KS3 Session 2 Sue Sentance and Sophie Baker
Lecture 8 Floating point format
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patterson and Hennessy Text.
Number Systems Lecture 02.
Binary Number Systems.
ES 84 Numerical Methods for Engineers, Mindanao State University- Iligan Institute of Technology Prof. Gevelyn B. Itao.
Binary Representation and Computer Arithmetic
Simple Data Type Representation and conversion of numbers
ES 244: Digital Logic Design Chapter 1 Chapter 1: Introduction Uchechukwu Ofoegbu Temple University.
EKT 121 / 4 ELEKTRONIK DIGIT 1 CHAPTER 1 : INTRODUCTION.
Binary Real Numbers. Introduction Computers must be able to represent real numbers (numbers w/ fractions) Two different ways:  Fixed-point  Floating-point.
Click to edit Master title style Click to edit Master text styles –Second level Third level –Fourth level »Fifth level 1 Today’s Topics How information.
Computer Architecture
Data Types and Representation CS French Chapter 6 + Chapter 7 – Number Bases.
Lecture Overview Introduction Positional Numbering System
Data Representation.
1 DLD Lecture 18 Recap. 2 Recap °Number System/Inter-conversion, Complements °Boolean Algebra °More Logic Functions: NAND, NOR, XOR °Minimization with.
ECE 331 – Digital System Design
The Teacher CP4 Binary and all that… CP4 Revision.
Chapter 2: The Logic of Compound Statements 2.5 Application: Number Systems and Circuits for Addition 1 Counting in binary is just like counting in decimal.
Lecture 2 Binary Values and Number Systems. The number 943 is an example of a number written in positional notation. The relative positions of the digits.
Operations on Bits Arithmetic Operations Logic Operations
The Teacher CP4 Binary and all that… CP4 Revision.
EET 250 Number systems. Introduction to Number Systems While we live in a world where the decimal number is predominant in our lives, computers and digital.
Data Representation Conversion 24/04/2017.
Fractions in Binary.
Positional Number Systems Decimal, Binary, Octal and Hexadecimal Numbers Wakerly Section
Chapter 2 Bits, Data Types, and Operations. 2-2 Hexadecimal Notation It is often convenient to write binary (base-2) numbers as hexadecimal (base-16)
CHAPTER 1 INTRODUCTION TO DIGITAL LOGIC
AEEE2031 Data Representation and Numbering Systems.
Data as the computer sees it 1.  Number systems Number systems  Data storage Data storage  Glossary Glossary 2.
MECH1500 Chapter 3.
1 Digital Logic Design Lecture 2 More Number Systems/Complements.
Data Representation. How is data stored on a computer? Registers, main memory, etc. consists of grids of transistors Transistors are in one of two states,
©Brooks/Cole, 2003 Chapter 3 Number Representation.
CS 125 Lecture 3 Martin van Bommel. Overflow In 16-bit two’s complement, what happens if we add =
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.
Software Design and Development Storing Data Computing Science.
Floating Point Numbers
Fundamentals of Computer Science
Number Systems & Binary Arithmetic
Topic: Binary Encoding – Part 1
Positional Number Systems Decimal, Binary, Octal and Hexadecimal Numbers Wakerly Section
Data Representation.
Number Systems and Binary Arithmetic
Recap Add these numbers together in binary
Integer Real Numbers Character Boolean Memory Address CPU Data Types
CHAPTER 1 : INTRODUCTION
Number Systems.
EPSII 59:006 Spring 2004.
CSE 102 Introduction to Computer Engineering
IT 0213: INTRODUCTION TO COMPUTER ARCHITECTURE
Overview Introduction Data representation Fixed Point Representation
BEE1244 Digital System and Electronics BEE1244 Digital System and Electronic Chapter 2 Number Systems.
CSCI206 - Computer Organization & Programming
Data Representation in Computer Systems
Digital Systems and Binary Numbers
Data Representation and Organization
Storing Integers and Fractions
23/04/2019 Data Representation Conversion.
Presentation transcript:

Representation of data types

Introduction We are going to look at representing cardinal numbers, integers and real numbers in decimal, binary, octal and hexadecimal. What do you already know ?

Overview Cardinal, integer and real data types Decimal representation Binary representation Alternative representation Exercises

Vocabulary Cardinal number Integer Real number Decimal Binary Octal Hexadecimal A positive whole number Any whole number Any fractional number Base 10 number system Base 2 number system Base 8 number system Base 16 number system

Cardinals, integers and reals Cardinal numbers are “counting numbers”. They form the series 0, 1, 2,…  Integers are “all whole numbers”. Cardinal numbers are a subset of integers. They form the series - ,… -1, 0, 1,…  Reals are numbers which include fractional values. There are an infinite number of real numbers between any two numbers.

Decimal numbers Based on the number of fingers we have – “digits”. Each digit represents some amount. Each digit can hold one numeral from 0 – 9. To represent numbers greater than 9, more digits must be used. Each digit has a place value which is a power of 10. The value of a number is the sum of the value of each digit multiplied by the place value of the digit. Fractional values are indicated by using a decimal point.

Binary numbers Digital devices represent numbers using only two binary digits (bits), 0 & 1. Electronic media use the flow of electricity to represent value: off / on, low / high voltage. Magnetic media use magnetised / unmagnetised “spots”. Optical media use pulses of light.

Number representation using binary Each bit can hold one numeral, either 0 or 1. To represent numbers greater than one, more bits need to be used. Each bit has a place value which is a power of 2. The value of a number is the sum of the value of each bit multiplied by the place value of the bit.

Cardinals are represented by a number of bits. The maximum magnitude of the number that can be represented by a number of bits equals n 2 -1, where n is the number of bits. Integers are also represented by a number of bits. One bit is the sign bit and the remaining bits are the modulus. A method called “twos complement” is used to determine the value of the number. Reals are represented like integers, with the incorporation of a “binary point”.

Real numbers have part of the modulus as integer values and part as fractional values. Fixed point notation as a set number of bits for integers and a set number for fractions. This limits the accuracy of number representation. Floating point notation varies the position of the binary point using an exponent, in the same way as decimal scientific notation. This allows more accurate number representation at the expense of magnitude and vice versa.

Octal Long strings of bits are cumbersome, so more convenient alternatives are needed. Octal is base-8, so each octal digit replaces 3 bits, but is easy to convert back to binary. However, splitting 8 bits (1 byte) into groups of three bits is inefficient and so octal is uncommon in modern practice.

Hexadecimal Hexadecimal is base-16 and uses A, B, C, D, E and F as numerals. Each hex digit replaces 4 bits, so 2 hex digits replace one byte. A file displayed as hex code will only be ¼ the apparent size of the same file displayed as binary. Hex is much easier to work with than raw binary.

Summary Differences between numeric data types Cardinal numbers Integer numbers Real numbers Different methods of representation Decimal Binary Octal Hexadecimal