Binary & Normalization 3.3.4. What is Normalization? We discussed this the other day (special review session slides, near the end) Can someone tell us.

Slides:



Advertisements
Similar presentations
Please turn in your Home-learning, get your notebook and Springboard book, and begin the bell-ringer! Test on Activity 6, 7 and 8 Wednesday (A day) and.
Advertisements

Integers. Integer Storage Since Binary consists only of 0s and 1s, we can’t use a negative sign ( - ) for integers. Instead, the Most Significant Bit.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
Faculty of Computer Science © 2006 CMPUT 229 Floating Point Representation Operating with Real Numbers.
Floating Point Numbers
Assembly Language and Computer Architecture Using C++ and Java
Signed Numbers.
Assembly Language and Computer Architecture Using C++ and Java
Floating Point Numbers
1 Binary Arithmetic, Subtraction The rules for binary arithmetic are: = 0, carry = = 1, carry = = 1, carry = = 0, carry =
Floating Point Numbers
Binary numbers. 1 Humans count using decimal numbers (base 10) We use 10 units: 0, 1, 2, 3, 4, 5, 6, 7, 8 and (5.
1 Binary Numbers Again Recall that N binary digits (N bits) can represent unsigned integers from 0 to 2 N bits = 0 to 15 8 bits = 0 to bits.
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 “There are 10 types of people in the world… those that understand binary and those that don’t.”
Binary Numbers 1.Binary and Denary RecapBinary.
Binary Number Systems.
Topic 4 Computer Mathematics and Logic
The Binary Number System
Data Representation Number Systems.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
Numbers and number systems
Fixed point binary numbers. Objectives  Draw a distinction between integers and numbers with a fractional part in a computer context.  Describe how.
Scientific Notation.
Scientific Notation Recognize and use scientific notation.
Binary Real Numbers. Introduction Computers must be able to represent real numbers (numbers w/ fractions) Two different ways:  Fixed-point  Floating-point.
Computer Arithmetic Nizamettin AYDIN
NUMBER REPRESENTATION CHAPTER 3 – part 3. ONE’S COMPLEMENT REPRESENTATION CHAPTER 3 – part 3.
IT253: Computer Organization
Floating Point. Agenda  History  Basic Terms  General representation of floating point  Constructing a simple floating point representation  Floating.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
Cosc 2150: Computer Organization Chapter 2 Part 1 Integers addition and subtraction.
BR 8/99 Binary Numbers Again Recall than N binary digits (N bits) can represent unsigned integers from 0 to 2 N bits = 0 to 15 8 bits = 0 to 255.
CSC 221 Computer Organization and Assembly Language
Introduction to Number System
Fractions in Binary.
How a Computer Processes Information. Java – Numbering Systems OBJECTIVE - Introduction to Numbering Systems and their relation to Computer Problems Review.
Number Systems & Operations
Extending Binary In today’s lesson we will look at: representing different types of numbers possible errors binary coded decimal (BCD) comparing BCD with.
CS1Q Computer Systems Lecture 2 Simon Gay. Lecture 2CS1Q Computer Systems - Simon Gay2 Binary Numbers We’ll look at some details of the representation.
Scientific Notation.  Allows us to write very big and very small numbers.
Lecture 6: Floating Point Number Representation Information Representation: Floating Point Number Representation Lecture # 7.
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.
Two’s Complement The language of machines, part II.
Software Design and Development Storing Data Computing Science.
Starter Using two’s Complement form convert the following from Denary to Binary using 8 bits. Answer on mini whiteboard Using two’s.
Lesson Objectives Aims You should know about: Binary numbers ‘n’ that.
Floating Point Numbers
Department of Computer Science Georgia State University
Data Representation Covering… Binary addition / subtraction
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.
Binary, Denary, Hexadecimal Conversion Binary Addition
Introduction To Computer Science
2's Complement Arithmetic
Recap Add these numbers together in binary
William Stallings Computer Organization and Architecture 7th Edition
Number Column Addition and Subtraction for Decimals
Topic 3: Data Signed Binary.
2’s Complement Arithmetic
1.6) Storing Integer:.
Number Representation
Binary  Name: Class: .
靜夜思 床前明月光, 疑是地上霜。 舉頭望明月, 低頭思故鄉。 ~ 李白 李商隱.
1.6) Storing Integer: 1.7) storing fraction:
Presentation transcript:

Binary & Normalization 3.3.4

What is Normalization? We discussed this the other day (special review session slides, near the end) Can someone tell us what normalization is?

What is Normalization? Normalization is the process of balancing range of values and accuracy of values with a limited amount of binary digits (8 bit, 16 bit, etc.) If we dedicate more of the binary digits to the integer value, then there are fewer to dedicate to the fraction value, thus the numbers will be limited in accuracy If we dedicate more binary digits to the fraction value, then we have fewer for the integer value, thus being limited in range We refer to the base value (integer + fraction) as the “mantissa”

Example

Answer

How to Convert Normalized Binary to Denary In any question you are asked to do this they will explain to you exactly which binary digits are the mantissa and which are the exponent, the rest is up to you! Follow the steps on the next slide

Normalized Binary to Denary Let’s follow an example: is a normalized binary number where the first three digits are the mantissa and the last three are the exponent. Convert this to denary 1: convert the exponent to denary. (next slide)

Normalized Binary to Denary In order to convert the exponent take 101 and line it up with the same binary-to- denary table you’ve been using for years This means that in order to get the denary value of the exponent, sum 4, 0, and 1. EXCEPT that the very first value is a 1, which means it needs to be a negative (in normalized binary if the first digit is a 1 it is always negative) So, the value is = -3 2^2 = 42^1 = 22^0 = 1 101

Normalized Binary to Denary So now we have three binary digits and a decimal exponent: 111^-3 We need to add a decimal point (I think you call it a full-stop here?) to the binary digits, because in normalized binary there are ALWAYS fractions By default we assume the decimal point goes after the very first digit, so: 1.11^-3 (the 1.11 is still in binary)

Normalized Binary to Denary 1.11^-3 We must now move the decimal point we just placed Move it to the left because the exponent is negative, and move it exactly three places because the exponent is

Normalized Binary to Denary We are nearly done! We have “undone” the normalization of this binary digit and now simply need to convert it in to denary = /(2^3) + 1/(2^4) + 1/(2^5) (notice this is the same pattern as that binary-to-denary conversion table) =1/8 + 1/16 + 1/32 = 7/32 Done!

Normalized Binary to Denary In review: Convert exponent to denary, don’t forget first digit is negative if it’s a 1 Add decimal place to base value Move decimal place based on value and sign of exponent Convert each digit to its denary equivalent

Example

Answer

Example

Answer

Example

Answer

Denary to Normalized Binary Now we have to be able to do the opposite! They might give you a number in denary and tell you to convert it in to normalized binary. They will tell you how many digits to use for the mantissa and the exponent, and nothing else!

Denary to Normalized Binary Let’s learn by example: convert 15 to normalized binary in which there are four digits for the mantissa and four for the exponent Step 1: convert 15 to binary Using the standard table, we find: 15 = 1111 in binary

Denary to Normalized Binary Next, we place the decimal point as far left as possible such that all the 1’s are to the right of the decimal: We can determine the value of the exponent from how many places we moved the decimal point: 4 places means the exponent is 4! (this time moving to the left means it’s positive, because we are doing this backwards)

Denary to Normalized Binary So far we know that the mantissa is (in binary) and the exponent is 4 (in denary) We need only convert the exponent in to binary and we are done! 4 = 0100 Remember to place the 0 in front of the 1 for two reasons: it has to be four digits in length and if it begins with a 1 then it is negative! Final answer: 15 =

Example

Answer

Important Information Important information: if you wish to convert a negative denary value in to binary, simply convert the positive value (or “absolute” value) in to binary, switch all of the 0’s and 1’s to their opposite, then add one. Eg. -5 to binary: 5 = 0101, swap the values: 1010, add one: 1011 = -5

Important Information If you need to convert a fraction (in denary) in to binary, you can use the same table we always use when converting denary to binary – simply add more columns to it! 2^2 = 42^1 = 22^0 = 12^-1 = 1/22^-2 = 1/42^-3 = 1/8

Important Information Example: convert ¼ from denary in to binary Solution: use the table we normally would! We normally say “what’s the largest number smaller than or equal to x on the table?” Do the same thing ¼ in denary, according to the table, is 0.01 in binary 2^2 = 42^1 = 22^0 = 12^-1 = 1/22^-2 = 1/42^-3 = 1/

Important Information Example: convert 3/4 from denary in to binary Solution: ½ is the largest number smaller than ¾ on the table, so place a 1 there. ¾ - ½ = ¼ The largest number smaller than or equal to ¼ on the table is ¼ ! So place a 1 there ¾ = ^2 = 42^1 = 22^0 = 12^-1 = 1/22^-2 = 1/42^-3 = 1/

More Examples The following two examples are harder! (Practice makes perfect)

Example

Answer

Example

Answer

What if there aren’t enough digits? What if we are using a format where only 4 digits are allocated to the mantissa but we need more than that for accuracy? For example, 5.75 = We can’t express that in 4 digits for the mantissa! In this case we would have to only record the 5 in binary and drop the fraction, reducing the accuracy

Done! That’s everything you need to know about normalized 2-compliment binary!