Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

1 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

2 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)

3 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

4 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

5 How to represent fractions?
Next problem… The number is the equivalent to /2 and 1/4 1 / 2 = 0.5 (1/2) 1 / 4 = 0.25 (1/4) 1/8 = (1/8) 1/16 = (1/16) Convert 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)

6 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).

7 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 the same as 3.45? Answer: 32 Bits How many bits in 4 bytes? 1st byte 2nd byte 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 4th byte

8 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 sign 8 1.2 x 10-38 3.4 x 1038 Double precision 14 significant digits 64 sign 11 5.0 x 1.8 x 10308

9 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.

10 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) Exponent (6 bits) 000011 Sign shows whether the number is positive (0) or negative (1)

11 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 We can work out the exponent equals the number? 2 + 1 = 3

12 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 which is… 30 seconds convert this binary number in to denary ¦ 4 ¦ 2 ¦ ½ ¦ ¼

13 Quiz – what is the correct answer?
Is the number 3.5 6.75 8 ¦ 4 ¦ 2 ¦ ½ ¦ ¼ 8.5 6.5 = 12.75 0.5

14 Convert the following binary numbers to denary
Exponent is 2 Answer is = 2.625 Exponent is 4 Answer is = 13.5

15 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

16 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!!


Download ppt "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."

Similar presentations


Ads by Google