Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


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

1 Binary & Normalization 3.3.4

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

3 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”

4 Example

5 Answer

6 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

7 Normalized Binary to Denary Let’s follow an example: 111101 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)

8 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 -4 + 1 = -3 2^2 = 42^1 = 22^0 = 1 101

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

10 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 3 0.00111

11 Normalized Binary to Denary 0.00111 We are nearly done! We have “undone” the normalization of this binary digit and now simply need to convert it in to denary 0.00111 = 0 + 0 + 1/(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!

12 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

13 Example

14 Answer

15 Example

16 Answer

17 Example

18 Answer

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

20 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 8421 1111

21 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: 0.1111 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)

22 Denary to Normalized Binary So far we know that the mantissa is 0.1111 (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 = 1111 0100

23 Example

24 Answer

25 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

26 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

27 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/8 000010

28 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 ¾ = 0.11 2^2 = 42^1 = 22^0 = 12^-1 = 1/22^-2 = 1/42^-3 = 1/8 000110

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

30 Example

31 Answer

32 Example

33 Answer

34 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 = 101.11 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

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


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

Similar presentations


Ads by Google