Objectives Today: P4 Data Types – Floating Points P4 Variable Quiz P3 Iteration and Selection Practical Are you logged on? Then come around the table Unit.

Slides:



Advertisements
Similar presentations
2009 Spring Errors & Source of Errors SpringBIL108E Errors in Computing Several causes for malfunction in computer systems. –Hardware fails –Critical.
Advertisements

Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
Chapter 5 Floating Point Numbers. Real Numbers l Floating point representation is used whenever the number to be represented is outside the range of integer.
Computer Science 210 Computer Organization Floating Point Representation.
Floating Point Numbers.  Floating point numbers are real numbers.  In Java, this just means any numbers that aren’t integers (whole numbers)  For example…
Binary Number Systems.
Binary Representation and Computer Arithmetic
The Binary Number System
Data Representation Number Systems.
Simple Data Type Representation and conversion of numbers
1 Lecture 5 Floating Point Numbers ITEC 1000 “Introduction to Information Technology”
Why does it matter how data is stored on a computer? Example: Perform each of the following calculations in your head. a = 4/3 b = a – 1 c = 3*b e = 1.
Binary Fractions. Fractions A radix separates the integer part from the fraction part of a number Columns to the right of the radix have negative.
16. Binary Numbers Programming in C++ Computer Science Dept Va Tech August, 1999 © Barnette ND, McQuain WD, Keenan MA 1 Binary Number System Base.
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
Fractions in Binary.
Number Systems Denary Base 10 Binary Base 2 Hexadecimal Base 16
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
Floating Point Binary A2 Computing OCR Module 2509.
Floating Point Numbers
CS 232: Computer Architecture II Prof. Laxmikant (Sanjay) Kale Floating point arithmetic.
Lecture 6: Floating Point Number Representation Information Representation: Floating Point Number Representation Lecture # 7.
CS 125 Lecture 3 Martin van Bommel. Overflow In 16-bit two’s complement, what happens if we add =
Learning Objectives 3.3.1f - Describe the nature and uses of floating point form 3.3.1h - Convert a real number to floating point form Learn how to normalise.
Starter Using two’s Complement form convert the following from Denary to Binary using 8 bits. Answer on mini whiteboard Using two’s.
Module 2.2 Errors 03/08/2011. Sources of errors Data errors Modeling Implementation errors Absolute and relative errors Round off errors Overflow and.
Floating Point Numbers
Introduction to Numerical Analysis I
Nat 4/5 Computing Science Lesson 1: Binary
Fundamentals of Computer Science
Data Representation Covering… Binary addition / subtraction
Backgrounder: Binary Math
Binary Fractions.
Computer Science 210 Computer Organization
A brief comparison of integer and double representation
Introduction To Computer Science
Recap Add these numbers together in binary
Data Representation Binary Numbers Binary Addition
CSCI 198: Lecture 4: Data Representation
Floating Point Math & Representation
Numbers in a Computer Unsigned integers Signed magnitude
CSCI 161: Lecture 4: Data Representation
Floating Point Number system corresponding to the decimal notation
EPSII 59:006 Spring 2004.
A Level Computing Component 2
Chapter 6 Floating Point
Binary Numbers Material on Data Representation can be found in Chapter 2 of Computer Architecture (Nicholas Carter) CSC 370 (Blum)
Number Representations
Data Representation Data Types Complements Fixed Point Representation
Computer Science 210 Computer Organization
Dr. Clincy Professor of CS
October 17 Chapter 4 – Floating Point Read 5.1 through 5.3 1/16/2019
Storing Negative Integers
Computer Organization
Numbers representations
Storing Integers and Fractions
Representation of real numbers
Normalised Floating Point Numbers
COMS 161 Introduction to Computing
Floating Point Numbers
CS 286 Computer Architecture & Organization
Data Binary Arithmetic.
Floating Point Binary Part 1
Numbers with fractions Could be done in pure binary
Computer Organization and Assembly Language
Theory: 2.6 – Data Representation
Number Representations
1.6) Storing Integer: 1.7) storing fraction:
Section 6 Primitive Data Types
Presentation transcript:

Objectives Today: P4 Data Types – Floating Points P4 Variable Quiz P3 Iteration and Selection Practical Are you logged on? Then come around the table Unit 6 Software Development Assignment 1

Quiz? Folks, discuss in pairs the following questions and write your answers down on the worksheet. (2 mins) What are integers? (2 points) What is a bit? (2 points) How many bits in a byte? (2 points)

What do you remember from yesterday? Do Floating Points include? 1. A Fraction system 2. Use of bytes Which of these are used to create the floating point? MRT Engagement Mantissa Expurgator Mantisigator Exponent

What is a Floating Point? How many bits are in 2 bytes? Answer: 16 bits. We can use many bytes to hold numbers especially very large numbers. Work out the following using 1 byte? Convert 136 to binary 128 ¦ 64 ¦ 32¦ 16 ¦ 8 ¦ 4 ¦ 2 ¦ 1 (5 points) 1 1

How to represent fractions? Next problem… The number 136.75 is the equivalent to 136 + 1/2 and 1/4 1 / 2 = 0.5 (1/2) 1 / 4 = 0.25 (1/4) 1/8 = 0.125 (1/8) 1/16 = 0.0625 (1/16) Convert 136.75 in to binary 128 ¦ 64 ¦ 32¦ 16 ¦ 8 ¦ 4 ¦ 2 ¦ 1 . 1/2 ¦ 1/4 ¦ 1/8 ¦ 1/16 What is the binary representation of .75? (5 points) 1 0 0 0 1 0 0 0 . 1 1 0 0

This is a very big number! 1,200,000,000,000.00000000000001 Another purpose of a floating point is to represent numbers of different magnitudes (sizes) and help maintain the accuracy of the number. This involves the use of many bytes. Physicists will use huge numbers in their calculations where as a microchip designer will need accuracy (1/10 of a millimetre is crucial).

Memory Since computer memory is limited (only so many ‘storage-cells’) when storing data, there is a limitation on the number of digits to represent real numbers. An example: is 3.456 the same as 3.45? Answer: 32 Bits How many bits in 4 bytes? 1st byte 128 64 32 16 8 4 2 1 2nd byte 32768 16384 8192 4096 2048 1024 512 256 What is the largest number represented by 32 bits that you can remember - maintain the accuracy of the number (every digit must be correct)? 3rd byte 8388608 4194304 2097152 1048576 524288 262144 131072 65536 4th byte 2147483648 1073741824 536870912 268435456 134217728 67108864 33554432 16777216

Single and Double Precision What is a single and a double? Single – a number with a decimal part. Double is a much bigger number with a decimal part. Format Total bits Significand bits Exponent bits Smallest number Largest number Single precision 7 significant digits 32 23 + 1 sign 8 1.2 x 10-38 3.4 x 1038 Double precision 14 significant digits 64 52 + 1 sign 11 5.0 x 10-324 1.8 x 10308

Floating Points in our Decimal System In decimal we can display large numbers as a MANTISSA and an EXPONENT 1,200,000,000,000 can be written as 0.12 X 1013 0.12 is called the mantissa and 1013 is the exponent Holds the digits and the exponent defines where to place the decimal point The decimal point has been moved 13 places to the left.

Floating Point in our Binary System The same techniques can be used for binary numbers 2 bytes (16 bits) can be divided into 10 bits for the mantissa (1 sign bit and 9 digits) and 6 bits for the exponent. Mantissa (10 bits) 0 . 110100000 Exponent (6 bits) 000011 Sign shows whether the number is positive (0) or negative (1)

Floating Point in our Binary System Let’s see what is happening with the Exponent… We can work out what the exponent is in denary 32 16 8 4 2 1 0 0 0 0 1 1 We can work out the exponent equals the number? 2 + 1 = 3

Floating Point in our Binary System Let’s use the exponent (which we know is 3) on the mantissa We move the binary point three places to the right; the number now becomes 110.1 which is… 30 seconds convert this binary number in to denary ¦ 4 ¦ 2 ¦ 1 . ½ ¦ ¼ 0110 . 100000 01 . 10100000 0 . 110100000 011 . 0100000

Quiz – what is the correct answer? Is the number 3.5 6.75 8 ¦ 4 ¦ 2 ¦ 1 . ½ ¦ ¼ 8.5 6.5 0110 . 10000 4 + 2 +0.5 = 12.75 0.5

Convert the following binary numbers to denary 0 . 101010000 000010 0 . 110110000 000100 Exponent is 2 010 . 1010000 Answer is 2 + .5 + .125 = 2.625 Exponent is 4 01101.10000 Answer is 8 + 4+ 1 + .5 = 13.5

Summing Up Quiz Why are Floating points used? Represent fraction system Represent large numbers What are floating points made up of? Mantissa with 1 sign bit Exponent  How are these parts used? Mantissa holds the digits representing the number Determines where the binary point needs to be placed

Use your answers Yippee!! Use your answers to write up how floating points are used for Assignment 1 Task 4. Print off this assignment for marking. Yippee!!