Ремонт частотника

mkdutDor
mkdutDor

le 07/02/2017 à 08:23 Citer ce message

= 129 - 127 = 2 mantissa = 2-1=0.5 The decimal equivalent of this number is +1.5 x 22 = +6.0. Example 1.31 Find the decimal equivalent of the floating point number: 0 10000010 11000000000000000000 Solution 1.31 In this example, sign = positive exponent = 130 - 127 = 3 mantissa = 2-1 + 2-2 = 0.75 The decimal equivalent of the number is +1.75 x 23 = 14.0. www.newnespress.com 34 Chapter 1 1.22.1 Normalizing Floating Point Numbers Floating point numbers are usually shown in normalized form. A normalized number has only one digit before the decimal point (a hidden number 1 is assumed before the decimal point). To normalize a given floating point number, we have to move the decimal point repeatedly one digit to the left and increase the exponent after each move. Some examples follow. Example 1.32 Normalize the floating point number 123.56 Solution 1.32 If we write the number with a single digit before the decimal point we get: 1.2356 x 102 Example 1.33 Normalize the binary number 1011.12 Solution 1.33 If we write the number with a single digit before the decimal point we get: 1.0111 x 23 1.22.2 Converting a Decimal Number into Floating Point To convert a given decimal number into floating point, carry out the following steps: Write the number in binary. Normalize the number. Find the mantissa and the exponent. Write the number as a floating point number. Some examples follow: www.newnespress.com Microcomputer Systems 35 Example 1.34 Convert decimal number 2.25 into floating point. Solution 1.34 Write the number in binary: 2.25x0 = 10.012 Normalize the number: 10.012 = 1.0012 x 21 Here, s = 0, e - 127 = 1 or e = 128, and f = 00100000000000000000000. (Remember that a number 1 is assumed on the left side, even though it is not shown in the calculation). The required floating point number can be written as: s e f 0 10000000 (1) 001 0000 0000 0000 0000 0000 or, the required 32-bit floating point number is: 01000000000100000000000000000000 Example 1.35 Convert the decimal number 134.0625 into floating point. Solution 1.35 Write the number in binary: 134.0 62 510 = 10000110.0001 Normalize the number: 10000110.0001 = 1.00001100001 x 27 Here, s = 0, e - 127 = 7 or e = 134, and f = 00001100001000000000000. www.newnespress.com 36 Chapter 1 The required floating point number can be written as: s e f 0 10000110 (1)00001100001000000000000 or, the required 32-bit floating point number is: 01000011000001100001000000000000 1.22.3 Multiplication and Division of Floating Point Numbers Multiplication and division of floating point numbers are rather easy. Here are the steps: Add (or subtract) the exponents of the numbers. Multiply (or divide) the mantissa of the numbers. Correct the exponent. Normalize the number. The sign of the result is the EXOR of the signs of the two numbers. Since the exponent is processed twice in the calculations, we have to subtract 127 from the exponent. An example showing the multiplication of two floating point numbers follows. Example 1.36 Show the decimal numbers 0.510 and 0.7510 in floating point and then calculate their multiplication. Solution 1.36 Convert the numbers into floating point as: 0.510 = 1.0000 x 2-1 here, s = 0, e - 127 = -1 or e = 126 and f = 0000 or, 0.510 = 0 01110110 (1)000 0000 0000 0000 0000 0000 Similarly, 0.7510 = 1.1000 x 2-1 www.newnespress.com Microcomputer Systems 37 here, s = 0, e = 126 and f = 1000 or, 0.7510 = 0 01110110 (1) 100 0000 0000 0000 0000 0000 Multiplying the mantissas results in (1)100 0000 0000 0000 0000 0000. The sum of the exponents is 126 + 126 = 252. Subtracting 127 from the mantissa, we obtain 252 - 127 = 125. The EXOR of the signs of the numbers is 0. Thus, the result can be shown in floating point as: 0 01111101 (1) 100 0000 0000 0000 0000 0000 This number is equivalent to decimal 0.375 (0.5 x 0.75 = 0.375), which is the correct result. 1.22.4 Addition and Subtraction of Floating Point Numbers The exponents of floating point numbers must be the same before they can be added or subtracted. The steps to add or subtract floating point numbers are: Shift the smaller number to the right until the exponents of both numbers are the same. Increment the exponent of the smaller number after each shift. Add (or subtract) the mantissa of each number as an integer calculation, without considering the decimal points. Normalize the result. An example follows. Example 1.37 Show decimal numbers 0.510 and 0.7510 in floating point and then calculate the sum of these numbers. Solution 1.37 As shown in Example 1.36, we can convert the numbers into floating point as: 0.510 = 0 01110110 (1)000 0000 0000 0000 0000 0000 www.newnespress.com 38 Chapter 1 Similarly, 0.7510 = 0 01110110 (1)100 0000 0000 0000 0000 0000 Since the exponents of both numbers are the same, there is no need to shift the smaller number. If we add the mantissa of the numbers without considering the decimal points, we get: (1) 000 0000 0000 0000 0000 0000 (1) 100 0000 0000 0000 0000 0000 + (10) . For more information visit site www.prom-electric.ru

Répondre à ce message

Code incorrect ! Essayez à nouveau